I am trying to load an image from a url and crop it. I created a method and uploaded it to the hosted services in the business logic section. My java code looks similar to this.
public void uploadProfilePhoto(int x, int y, int w, int h, String filePath) {
try {
BufferedImage originanlImg = ImageIO.read(new URL(filePath));
BufferedImage croppedImg = originanlImg.getSubimage(x, y, w, h);
} catch (IOException e) {
logger.debug(e.getMessage());
}
}
However, it is crashing on the ImageIO.read line. I am getting this error when I test it in the console:
{
“code”: 0,
“message”: “java.lang.NoClassDefFoundError: Could not initialize class javax.imageio.ImageIOServiceException”
}
It is either the call to ImageIO.read creates a thread (which is not allowed yet in custom code) or one of the dependent classes is missing in the jar you deployed.