We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

NoClassDefFoundError: com.sun.imageio.plugins.jpeg.JPEGImageReader

Hello dear Support,

we couldn’t find a reference to the support of openJDK 11.
Does Aspose.Cells support Java 11?

We get this error when converting any Xlsx with an jpeg to pdf on Linux (CentOS) with OpenJDK 11.

So maybe our exception below is linked to the use of openJDK 11?

Thanks a lot

Caused by: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.sun.imageio.plugins.jpeg.JPEGImageReader
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:982)
	... 77 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.sun.imageio.plugins.jpeg.JPEGImageReader
	at java.desktop/com.sun.imageio.plugins.jpeg.JPEGImageReaderSpi.createReaderInstance(JPEGImageReaderSpi.java:85)
	at java.desktop/javax.imageio.spi.ImageReaderSpi.createReaderInstance(ImageReaderSpi.java:320)
	at java.desktop/javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:532)
	at java.desktop/javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:516)
	at com.aspose.cells.b.a.b.za.<init>(Unknown Source)
	at com.aspose.cells.b.a.b.zj.a(Unknown Source)
	at com.aspose.cells.zax.a(Unknown Source)
	at com.aspose.cells.zax.a(Unknown Source)
	at com.aspose.cells.zax.c(Unknown Source)
	at com.aspose.cells.zax.a(Unknown Source)
	at com.aspose.cells.zax.a(Unknown Source)
	at com.aspose.cells.zax.a(Unknown Source)
	at com.aspose.cells.zax.a(Unknown Source)
	at com.aspose.cells.zax.b(Unknown Source)
	at com.aspose.cells.zax.c(Unknown Source)
	at com.aspose.cells.zax.a(Unknown Source)
	at com.aspose.cells.a.d.zfs.a(Unknown Source)
	at com.aspose.cells.zccq.a(Unknown Source)
	at com.aspose.cells.zccq.a(Unknown Source)
	at com.aspose.cells.zccq.a(Unknown Source)
	at com.aspose.cells.zjk.a(Unknown Source)
	at com.aspose.cells.Workbook.a(Unknown Source)
	at com.aspose.cells.Workbook.save(Unknown Source)
	at com.orgavision.service.aspose.ExcelFileHandler.writeResponse(ExcelFileHandler.java:91)
	at com.orgavision.service.aspose.AbstractOfficeFileHandler.export(AbstractOfficeFileHandler.java:101)
	at com.orgavision.service.content.repo.JcrFileService.getPDF(JcrFileService.java:204)
	at com.orgavision.controller.files.JcrFileController.getPDF(JcrFileController.java:148)
	at com.orgavision.controller.files.JcrFileController$$FastClassBySpringCGLIB$$ca58a584.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:56)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
	at org.springframework.aop.aspectj.AspectJAfterAdvice.invoke(AspectJAfterAdvice.java:47)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671)
	at com.orgavision.controller.files.JcrFileController$$EnhancerBySpringCGLIB$$5934f644.getPDF(<generated>)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:849)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:760)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
	... 77 more

@orgavision,

We have tested our product for JDK 11 and no issues are found. Similarly there should be no issue with OpenJDK 11. You may try with some simple XLSX file without any JPEG or other image and test in your environment. It you find still issues, please share the error message with us for our analysis. To be sure that there are no configuration issues, please try any other external library as well like “org.apache.commons.lang3.*” used in the following example and check if paths are used properly to refer the jar files, source files and class files.

import org.apache.commons.lang3.*;
import com.aspose.cells.Workbook;

public class Main
{
    public static void main(String[] args) throws Exception {
        String x = "abcd";
        System.out.println(StringUtils.capitalize(x));
        Workbook wb = new Workbook();
        System.out.println(wb.getWorksheets().get(0).getName());
    }
}

If you find no issue with the simple workbook but get issue with the workbook having jpeg, we will log issue for detailed analysis.

Thank you for the fast reply,

the excel can be converted to pdf when I remove the Image first.
Also it works on my local Win10 develop machine with the same jdk.

The output for your example is:
Abcd
Sheet1

How can I get detailed logs for you from the convert-process ?

Thank you

@orgavision,

We have investigated it a bit. It seems that it is the open JDK problem on your side. Please try the following code on your side:

        ImageInputStream iis = ImageIO.createImageInputStream(new FileInputStream("your image path"));
	Iterator<ImageReader> it = ImageIO.getImageReaders(iis);
	if(it.hasNext())
	{
		ImageReader reader = it.next();
	}

the exception should occur on the line “ImageReader reader = it.next();”

Or directly try the code:

ImageIO.read(new FileInputStream("your image path"));

Let us know your feedback.

Hi again,

maybe this have something to do with our other topic

There was also an Exception that did occur only once for the sample xlsx with the Jpeg.

java.lang.NullPointerException
	at org.apache.commons.io.input.ProxyInputStream.markSupported(ProxyInputStream.java:180)
	at com.aspose.cells.b.a.d.zi.<init>(Unknown Source)
	at com.aspose.cells.a.c.zy.a(Unknown Source)
	at com.aspose.cells.Workbook.<init>(Unknown Source)

I’m confused :frowning:

I’ll try to create a sample project that reproduces this error reliable.

Thank you

@orgavision,

You are welcome and feel free to write us back when sample project is ready to reproduce this issue.