Page 1 of 1

NoClassDefForundError: Could not initialize class org.docx4j

PostPosted: Thu Nov 15, 2012 6:17 am
by jasonang
Hi,

I am using docx4j 2.7.1 on a Linux x86_64. environment running weblogic 10.3. The java runtime is 1.6.0_25.

When loading the docx document with embedded image, I saw the following exception in the log.

java.lang.NoClassDefFoundError: Could not initialize class org.docx4j.openpackaging.parts.WordprocessingML.ImagePngPart at org.docx4j.openpackaging.contenttype.ContentTypeManager.newPartForContentType(ContentTypeManager.java:365) at org.docx4j.openpackaging.contenttype.ContentTypeManager.getPart(ContentTypeManager.java:267) at org.docx4j.openpackaging.io.LoadFromZipNG.getRawPart(LoadFromZipNG.java:519) at

I saw a similar question ask here:
docx-java-f6/exception-trying-to-load-document-t995.html

I have also confirmed that the classpath has the required jars (including xml-graphics-commons-1.4.jar) for docx4j.

I don't think the jars are missing from the classpath. When I removed the image from the docx document, it loads without issue.

Please give me some hint on how this can be resolved? I need this to work for a project which is due for release candidate tomorrow.

Thanks!
Jason

Re: NoClassDefForundError: Could not initialize class org.do

PostPosted: Tue Nov 20, 2012 2:41 pm
by jason
ImagePngPart extends BinaryPartAbstractImage, so does it happen with other image types?

If so, have a look at BinaryPartAbstractImage's imports; this includes:

import java.awt.Dimension;
import java.awt.geom.Dimension2D;

Do you have -Djava.awt.headless=true in your startup script? See http://www.coderanch.com/t/456284/Linux ... lize-class

Which Linux, exactly?