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

Free Support Forum - aspose.com

java.lang.ExceptionInInitializerError from PresentationEx under Documentum

Hello,

I’m using Aspose Java components to extract built-in dates from Office and PDF documents when they’re uploaded into Documentum. Everything works fine except PowerPoint2007 documents. The following fragment causes the problem:

byte[] content = …;

ByteArrayInputStream stream = new ByteArrayInputStream(content);
com.aspose.slides.pptx.PresentationEx ppt = new com.aspose.slides.pptx.PresentationEx(stream);
com.aspose.slides.pptx.DocumentPropertiesEx builtIn = ppt.getDocumentProperties();
Date date = builtIn.getCreatedTime();


When being executed under Documentum, it results in the following error:

java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.aspose.slides.pptx.PresentationEx.(SourceFile:1743)
at com.iv.asposeutil.AsposePropertyParser.getPowerPoint2007Properties(AsposePropertyParser.java:544)
at com.iv.asposeutil.AsposePropertyParser.getPowerPointProperties(AsposePropertyParser.java:415)
Caused by: java.lang.NullPointerException
at com.aspose.slides.obfuscated.sl.do(SourceFile:39)
at com.aspose.slides.obfuscated.lj.(SourceFile:128)
at com.aspose.slides.obfuscated.lj.(SourceFile:116)
at com.aspose.slides.obfuscated.hs.(SourceFile:258)
at com.aspose.slides.obfuscated.hs.(SourceFile:218)
at com.aspose.slides.obfuscated.zr.for(SourceFile:943)
at com.aspose.slides.obfuscated.kw.(SourceFile:121)
… 24 more
java.lang.NullPointerException
at com.aspose.slides.obfuscated.sl.do(SourceFile:39)
at com.aspose.slides.obfuscated.lj.(SourceFile:128)
at com.aspose.slides.obfuscated.lj.(SourceFile:116)
at com.aspose.slides.obfuscated.hs.(SourceFile:258)
at com.aspose.slides.obfuscated.hs.(SourceFile:218)
at com.aspose.slides.obfuscated.zr.for(SourceFile:943)
at com.aspose.slides.obfuscated.kw.(SourceFile:121)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.aspose.slides.pptx.PresentationEx.(SourceFile:1743)


Important notes:

  • The same code works perfectly well being executed in a console Java App.
  • Other document formats are supported by similar code and all of them work well in Documentum.
  • I’m using aspose.slides_2.3.0_20100710.jar with aspose-metafiles-1.6.1-20100110.jar, and fresh versions of jai_codec.jar and jai_core.jar.
  • when testing in the console Java App, I used exactly the same set of JAR files as used in Documentum.
  • The byte array in all cases contained valid document.
Documentum stores the JARs in its repository (database), so it, perhaps, uses custom ClassLoader to make the JARs available for the code. My guess is that there is a conflict between PresentationEx logic and the Documentum’s class loader, since PresentationEx uses three external jars. Other Aspose components (like words.Document) do not refer external libs and, therefore, work fine.

Can you please help me with the problem? At least, please confirm or disprove my guess about the ClassLoader.

Thanks!

Hi Suren,

Thanks for your interest in Aspose.Slides.

I have tried to understand the issue specified by you. We are trying to investigate the possible cause of issue. We appreciate your patience and will respond you ASAP we have some information available.

Thanks and Regards,

This was Classloader problem and I figured out how to fix this. The Aspose code must be wrapper into this:

ClassLoader tccl = Thread.currentThread().getContextClassLoader();

try
{
ClassLoader cl = AsposePropertyParser.class.getClassLoader();
Thread.currentThread().setContextClassLoader(cl);

[Aspose calls go here]

}
finally
{
Thread.currentThread().setContextClassLoader(tccl);
}


Anyway, thanks for the prompt response!