Page 1 of 1

Getting java.lang.NoClassDefFoundError on UNIX server

PostPosted: Thu Jan 10, 2013 10:26 pm
by rpyadav87@gmail.com
Hi,

I am getting below error while reading image on UNIX server. However, it is working fine on window machine.

java.lang.NoClassDefFoundError: Could not initialize class org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage
com.thompson.handbook.publish.export.ExportToWord.newImage(ExportToWord.java:657)
com.thompson.handbook.publish.export.ExportToWord.getHdr(ExportToWord.java:623)
com.thompson.handbook.publish.export.ExportToWord.createHeaderPart(ExportToWord.java:618)
com.thompson.handbook.publish.export.ExportToWord.exportWordDocument(ExportToWord.java:224)
handbook.logic(handbook.java:133)
lf.BasePage.getTemplateName(BasePage.java:165)
lf.LFServlet.handle(LFServlet.java:56)
org.webmacro.servlet.WMServlet.doRequest(WMServlet.java:255)
org.webmacro.servlet.WMServlet.doGet(WMServlet.java:195)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:404)
org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:136)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

I am using docx4j.jar for it and also the missing class "BinaryPartAbstractImage" is existing in jar.
Even i replaced the docx4j .jar of unix machine with one i have on window machine and restarted the server but did not help.
I dont know why it is happening.
Please assist.

Re: Getting java.lang.NoClassDefFoundError on UNIX server

PostPosted: Thu Jan 10, 2013 10:43 pm
by jason
docx-java-f6/noclassdefforunderror-could-not-initialize-class-org-docx4j-t1251.html seems like the same problem.

He is running weblogic, unlike your tomcat.

Re: Getting java.lang.NoClassDefFoundError on UNIX server

PostPosted: Fri Jan 11, 2013 2:23 am
by rpyadav87@gmail.com
Hi,

I done the required changes as suggested i.e in opt/tomcat/bin/setenv.sh
I added below line:
#!/bin/sh
export JAVA_OPTS="${JAVA_OPTS} -Djava.awt.headless=true"by setting -Djava.awt.headless=true in

After it I got new error as below:
java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:150)

Could you pleae tell me why I am getting this error after setting Djava.awt.headless=true.
Pleae assist.

Re: Getting java.lang.NoClassDefFoundError on UNIX server

PostPosted: Fri Jan 11, 2013 8:20 am
by jason
See docx-java-f6/problem-creating-inserting-images-on-server-t195.html

I think you have an old version of xmlgraphics-commons.jar. Try 1.4 or 1.5.