Page 1 of 1

JIRA - ExceptionInInitializerError

PostPosted: Tue May 28, 2013 12:06 am
by csw026
When I run the following code, I got exceptioninitializererror.

String inputfilepath = "Stamp_Template.docx";
WordprocessingMLPackage wordMLPackage= null;

File templatef = new File(inputfilepath);
try {
wordMLPackage = WordprocessingMLPackage.load(templatef);
} catch (Docx4JException e) {
System.err.println("Caught DocException: " + e.getMessage());
}



java.lang.ExceptionInInitializerError
at org.docx4j.convert.out.pdf.viaXSLFO.Conversion.<clinit>(Conversion.java:103)
at org.docx4j.utils.Log4jConfigurator.configure(Log4jConfigurator.java:48)
at org.docx4j.jaxb.Context.<clinit>(Context.java:51)
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:666)
at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:206)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:193)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:301)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:245)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:195)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:178)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:172)
at com.motorolasolutions.osrb.servlet.StampGeneration.doGet(StampGeneration.java:130)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at com.atlassian.plugin.servlet.DelegatingPluginServlet.service(DelegatingPluginServlet.java:42)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at com.atlassian.plugin.servlet.ServletModuleContainerServlet.service(ServletModuleContainerServlet.java:52)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.atlassian.jira.web.filters.steps.ChainedFilterStepRunner.doFilter(ChainedFilterStepRunner.java:78)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.atlassian.jira.web.filters.XContentTypeOptionsNoSniffFilter.doFilter(XContentTypeOptionsNoSniffFilter.java:22)
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
.........(more)

I use 2.8.1 docx4j.

Any comment.

If I run:
public static JAXBContext context = org.docx4j.jaxb.Context.jc;

I can not even start servlet. I got the similar
ExceptionInInitializerError.

Re: load file with ExceptionInInitializerError

PostPosted: Tue May 28, 2013 12:29 am
by jason
I assume things work for you in your development environment (IDE), and that you only have problems where deploying to your app server?

Which one is it - make and version?

These problems usually relate to old JAXB or Xalan or Serializer jars; some of the posts in the deployment forums may help.

Re: load file with ExceptionInInitializerError

PostPosted: Tue May 28, 2013 12:53 am
by csw026
I created a plugin in JIRA environment. JIRA use Tomcat .

When I run in development IDE. I got the following error.

java.lang.NumberFormatException: null
at java.lang.Long.parseLong(Long.java:375)
at java.lang.Long.parseLong(Long.java:468)
at com.motorolasolutions.osrb.servlet.StampGeneration.doGet(StampGeneration.java:121)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at com.atlassian.plugin.servlet.DelegatingPluginServlet.service(DelegatingPluginServlet.java:42)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at com.atlassian.plugin.servlet.ServletModuleContainerServlet.service(ServletModuleContainerServlet.java:52)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.atlassian.jira.web.filters.steps.ChainedFilterStepRunner.doFilter(ChainedFilterStepRunner.java:78)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.atlassian.core.filters.HeaderSanitisingFilter.doFilter(HeaderSanitisingFilter.java:44)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

Re: load file with ExceptionInInitializerError

PostPosted: Tue May 28, 2013 1:38 am
by csw026
Thanks!!!

ignore the error in development IDE. When I try to run in deveoppment. It give me many error due to the database setup environement. The

java.lang.ExceptionInInitializerError
at org.docx4j.convert.out.pdf.viaXSLFO.Conversion.<clinit>(Conversion.java:103)
at org.docx4j.utils.Log4jConfigurator.configure(Log4jConfigurator.java:48)
at org.docx4j.jaxb.Context.<clinit>(Context.java:51)
at org.docx4j.openpackaging.contenttype.ContentTypeManager.p
etc.

is the development IDE environemtnt error.

Re: load file with ExceptionInInitializerError

PostPosted: Tue May 28, 2013 2:19 am
by csw026
Jason,
Any more comment. I have struggled for this the past a few days. I keep digging the form and google. Hope to get some more help.

Regards,

Re: load file with ExceptionInInitializerError

PostPosted: Tue May 28, 2013 8:20 am
by jason
docx4j works fine in Tomcat. Generally its just a matter of putting docx4j and all its dependencies into your webapp's WEB-INF/lib dir.

Find out whether JIRA uses Tomcat 6 or 7, then try deploying a simple servlet in standalone Tomcat which just opens a docx file using docx4j.

Once you have that configured correctly, you can introduce JIRA into the equation.

Re: load file with ExceptionInInitializerError

PostPosted: Sat Jun 01, 2013 7:23 am
by csw026
Source xsltSource = new StreamSource(
org.docx4j.utils.ResourceUtils.getResource(
"org/docx4j/convert/out/pdf/viaXSLFO/docx2fo.xslt"));
xslt = XmlUtils.getTransformerTemplate(xsltSource);

The problem is the code at:

xslt = XmlUtils.getTransformerTemplate(xsltSource);

I tried in a standalone application. Everything is working fille. I can get it work at tomcat.

Any suggestion??

Re: load file with ExceptionInInitializerError

PostPosted: Sat Jun 01, 2013 7:51 am
by csw026
I can make it work in tomcat environment. Some progress is made in Tomcat. But it still give me the same error in JIRA environment.

Re: load file with ExceptionInInitializerError

PostPosted: Mon Jun 03, 2013 1:05 pm
by jason
So how did you make it work in Tomcat? Was it a matter of using xalan 2.7.1 and corresponding serializer.jar?

You need make sure xalan 2.7.1 and corresponding serializer.jar are available to docx4j in JIRA... Which version of JIRA are you using, and which Xalan, if any, does it ship with?

See https://jira.atlassian.com/browse/JRA-26495 and https://jira.atlassian.com/browse/JRA-25485

Re 25485, docx4j should be able to use Xalan (as opposed to Saxon) provided it is there.

Please let us know how you resolve this, or feel free to post with further data