Free Support Forum - aspose.com

Error reading PPTX file with Aspose Java (JAI classnotfound)

Hi,

I get the following (see stacktrace below) when try to open a PPTX file with Aspose Java.

The test case to open the file is below, the line it fails at is
PresentationEx presentation = new PresentationEx(stream);

It seems from the stacktrace that Aspose has a dependency on a class from the
JAI project http://java.net/projects/jai/

Will Aspose come with this binary dependency? If not which Jar should I download from
the JAI project?

Regards,

Éamonn


@Test
public void testReadPptx() throws Exception {
ClassLoader cl = getClass().getClassLoader();
InputStream stream = cl.getResourceAsStream("ppt1.pptx");
Assert.assertNotNull(stream);

PresentationEx presentation = new PresentationEx(stream);

SlideEx slide = presentation.getSlides().get(0);
System.out.println(slide.getNotesSlide().toString());
}

java.lang.NoClassDefFoundError: com/sun/media/jai/codec/ByteArraySeekableStream
at com.aspose.slides.obfuscated.azo$14.do(SourceFile:452)
at com.aspose.slides.obfuscated.as.if(SourceFile:33)
at com.aspose.slides.obfuscated.as.if(SourceFile:40)
at com.aspose.slides.obfuscated.as.if(SourceFile:40)
at com.aspose.slides.obfuscated.as.if(SourceFile:40)
at com.aspose.slides.obfuscated.as.if(SourceFile:40)
at com.aspose.slides.obfuscated.as.(SourceFile:17)
at com.aspose.slides.obfuscated.azo.if(SourceFile:258)
at com.aspose.slides.obfuscated.azo.(SourceFile:180)
at com.aspose.slides.pptx.PresentationEx.(SourceFile:1127)
at com.aspose.slides.pptx.PresentationEx.(SourceFile:1113)
at org.test.asposejava.PptUseCasesTest.testReadPptx(PptUseCasesTest.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: com.sun.media.jai.codec.ByteArraySeekableStream
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 34 more

Hi Eamonn,

Thanks for your interest in Aspose.Slides.

I have observed that you are not fulfilling the complete system requirements. Aspose.Slides for Java requires JAI jar files for image rendering inside slide. Please proceed to this documentation link for further reference.

Thanks and Regards,

Hi Mudassir,

Thanks for that, I didn't see those requirements.

Have a nice weekend

Éamonn