Page 1 of 1

Failed to deploy Docx4j app to JBoss EAP 6.2 :/

PostPosted: Thu Nov 28, 2013 11:49 pm
by cronicz
Hey there,

recently I tried to deploy my application, which utilizes docx4j, to a JBoss 6.2 EAP Server. Unfortunately the process of generating docx documents does not work anymore on EAP 6.2 though everything is fine on JBoss 7.1.1.

A few exceptions that caught my attention:

Code: Select all
Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper from [Module "deployment.ProfilerApp.ear:main" from Service Module Loader]
   at org.jboss.modules.ModuleClassLoader.findClass( [jboss-modules.jar:1.3.0.Final-redhat-2]
   at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked( [jboss-modules.jar:1.3.0.Final-redhat-2]
   at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked( [jboss-modules.jar:1.3.0.Final-redhat-2]
   at org.jboss.modules.ConcurrentClassLoader.performLoadClass( [jboss-modules.jar:1.3.0.Final-redhat-2]
   at org.jboss.modules.ConcurrentClassLoader.loadClass( [jboss-modules.jar:1.3.0.Final-redhat-2]

Code: Select all
Caused by: java.lang.NoClassDefFoundError: com/sun/xml/internal/bind/marshaller/NamespacePrefixMapper
   at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_45]
   at java.lang.ClassLoader.defineClass( [rt.jar:1.7.0_45]
   at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass( [jboss-modules.jar:1.3.0.Final-redhat-2]
   at org.jboss.modules.ModuleClassLoader.defineClass( [jboss-modules.jar:1.3.0.Final-redhat-2]

Code: Select all
13:41:23,345 WARN  [org.jboss.modules] (http-/ Failed to define class org.docx4j.jaxb.NamespacePrefixMapperSunInternal in Module "deployment.ProfilerApp.ear:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/docx4j/jaxb/NamespacePrefixMapperSunInternal (Module "deployment.ProfilerApp.ear:main" from Service Module Loader)
   at org.jboss.modules.ModuleClassLoader.defineClass( [jboss-modules.jar:1.3.0.Final-redhat-2]
   at org.jboss.modules.ModuleClassLoader.loadClassLocal( [jboss-modules.jar:1.3.0.Final-redhat-2]
   at org.jboss.modules.ModuleClassLoader$1.loadClassLocal( [jboss-modules.jar:1.3.0.Final-redhat-2]

The errors are thrown while executing the following line of code:

Code: Select all
WordprocessingMLPackage wml = WordprocessingMLPackage.load(new File("template.docx"));

In my pom.xml I added the following dependency:

Code: Select all

Any idea what needs to be changed? Any help is highly appreciated! Thanks in advance :)

Re: Failed to deploy Docx4j app to JBoss EAP 6.2 :/

PostPosted: Fri Nov 29, 2013 10:58 am
by thezed
Your issue may be with JBoss modules not giving the docx4j code access to the com.sun.xml.bind classes.

In the module you have your docx4j jar file defined in, add the following dependency to module.xml:

Code: Select all
    <module name="com.sun.xml.bind" />

I had a similar issue.

Note you will most likely still get some ClassNotFoundException warnings from the JBoss class loaders because they can't find com.sun.xml.internal.*, but docx4j should then fall back to using com.sun.xml.bind and work okay.

Re: Failed to deploy Docx4j app to JBoss EAP 6.2 :/

PostPosted: Mon Jan 20, 2014 8:24 pm
by asyal
Hi thezed

I am facing a similar issue. I am using jboss 7.1.1 with docx4j 2.8.1. Either i end up getting NoClassDefFoundError for class or
at java.util.Collections$EmptySet$ [rt.jar:1.6.0_31]
at java.util.Collections$1.nextElement( [rt.jar:1.6.0_31]
at org.docx4j.utils.Log4jConfigurator.configure( [docx4j-2.8.1.jar:]
at org.docx4j.jaxb.Context.<clinit>( [docx4j-2.8.1.jar:]

Could you plz help me in this regards? This is what i have tried so far
!) Putting all the docx4j jars in the standalone\deployment folder
2) creating jboss-deployment-structure.xml as indicated in this forum

but i have not tried what you mentioned , like creating modules etc. Could you please elaborate on this ? Three are so many jar files related to docx4j. Do we go ahead and create modules for each one of them or what?

Any help in this regard is very appreciable.


Re: Failed to deploy Docx4j app to JBoss EAP 6.2 :/

PostPosted: Tue Jan 21, 2014 7:44 am
by jason
asyal wrote:Either i end up getting NoClassDefFoundError for class or

Well the NoSuchElementException is better than NoClassDefFoundError for, since at least in this case you have successfully got docx4j on your classpath. That error is related to log4j configuration. Either fix it, or you could use docx4j 3.0 instead, which doesn't have Log4jConfigurator anymore.

Re: Failed to deploy Docx4j app to JBoss EAP 6.2 :/

PostPosted: Sat Aug 09, 2014 8:22 am
by melgacorm
Hi there.

I have the exactly same issue.
I'm trying to use docx4j version 3.0.1 in jboss EAP 6.2. Getting the same stack.

I already tried do add <module name="com.sun.xml.bind" /> to the dependencies in my jboss-deployment-structure.xml, but it had no effect.

It works fine in Tomcat.

Any other hint?

Thanks. Regards,