0

I am trying to run docx4j on the wildfyl-10 server. I always get the following exceptions:

> INFO org.docx4j.jaxb.Context - java.vendor=Oracle Corporation
>     INFO org.docx4j.jaxb.Context - java.version=1.8.0_91
>     INFO org.docx4j.jaxb.Context - No MOXy JAXB config found; assume not intended..
>     WARN org.docx4j.jaxb.NamespacePrefixMapperUtils - name:    com.sun.xml.internal.bind.namespacePrefixMapper value:   
> org.docx4j.jaxb.NamespacePrefixMapperSunInternal@5ac63c7a .. trying
> RI.
>     INFO org.docx4j.jaxb.NamespacePrefixMapperUtils - Using NamespacePrefixMapper, which is suitable for the JAXB RI
>     INFO org.docx4j.jaxb.Context - Using JAXB Reference Implementation
>     INFO org.docx4j.jaxb.Context - Not using MOXy; using com.sun.xml.bind.v2.runtime.JAXBContextImpl
>     WARN org.docx4j.utils.ResourceUtils - Couldn't get resource: docx4j.properties
>     WARN org.docx4j.Docx4jProperties - Couldn't find/read docx4j.properties; docx4j.properties not found via classloader.
>     INFO org.docx4j.XmlUtils - setProperty com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
>     INFO org.docx4j.XmlUtils - actual: com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
>     INFO org.docx4j.XmlUtils - setProperty com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
>     INFO org.docx4j.XmlUtils - actual: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
>     INFO org.docx4j.openpackaging.contenttype.ContentTypeManager - Detected WordProcessingML package 
>     INFO org.docx4j.openpackaging.io3.Load3 - Instantiated package of type org.docx4j.openpackaging.packages.WordprocessingMLPackage
>     INFO org.docx4j.utils.XPathFactoryUtil - xpath implementation: __redirected.__XPathFactory
>     INFO org.docx4j.openpackaging.io3.Load3 - package read;  elapsed time: 3269 ms
>     WARN org.docx4j.jaxb.NamespacePrefixMapperUtils - name: com.sun.xml.internal.bind.namespacePrefixMapper value:
> org.docx4j.jaxb.NamespacePrefixMapperRelationshipsPartSunInternal@63f5c9a4
> .. trying RI.
>     INFO org.docx4j.jaxb.NamespacePrefixMapperUtils - Using NamespacePrefixMapperRelationshipsPart, which is suitable for the JAXB
> RI

module on wildfly:

<module xmlns="urn:jboss:module:1.3" name="org.docx4j">
<resources>
<resource-root path="antlr-runtime-3.5.2.jar"/>
....
<resource-root path="docx4j-ImportXHTML-3.3.1.jar"/>

</resources>

<dependencies>

<module name="org.antlr"/>
<module name="sun.jdk"/>
<system export="true">
    <paths>
        <path name="com/sun/xml/internal/bind/marshaller"/>
    </paths>
</system>   
 <module name="javax.xml.bind.api"/>    
<module name="javax.api"/>              
<module name="com.sun.xml.bind" />

</dependencies>
</module>

jboss-deployment on ear:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.3">
<sub-deployment name="Be.jar">
    <dependencies>
        <module name="com.sun.xml.bind" />
        <module name="org.docx4j" export="true" />
    </dependencies>
</sub-deployment>
</jboss-deployment-structure>

none of the solutions proposed for the earlier versions of the server appears to be working. Does anyone have an idea?

JasonPlutext
  • 15,352
  • 4
  • 44
  • 84
  • 1
    What exception? The log you include indicates JAXB Reference Implementation is in use. It doesn't show any problem. – JasonPlutext Nov 22 '16 at 20:43
  • I see something like this on the console 10:33:48,920 ERROR [stderr] (default task-56) [default task-56] INFO org.docx4j.jaxb.NamespacePrefixMapperUtils - Using NamespacePrefixMapperRelationshipsPart, which is suitable for the JAXB RI – Francesco Salvatore Nov 23 '16 at 09:57
  • I don't know what "ERROR [stderr] (default task-56) [default task-56]" is (its not docx4j), but "INFO org.docx4j.jaxb.NamespacePrefixMapperUtils - Using NamespacePrefixMapperRelationshipsPart, which is suitable for the JAXB RI" is perfectly OK. – JasonPlutext Nov 23 '16 at 10:06
  • You're right! I add and I removed from docx4j module descriptor and I solved the problem. Thank You – Francesco Salvatore Nov 23 '16 at 10:28
  • Great. Please write your final module and jboss deployment as an answer, and mark it correct :-) – JasonPlutext Nov 23 '16 at 11:20

1 Answers1

0

After removing slf4j-api-xxx.jar from docx4j module descriptor, the problem was solved.

Docx4j module descriptor on Wildfly 10 with logging (SLF4J) enabled:

<module xmlns="urn:jboss:module:1.3" name="org.docx4j">
<resources>

   <!--<resource-root path="slf4j-api-1.7.21.jar"/>  -->

   <resource-root path="antlr-runtime-3.5.2.jar"/>
   <resource-root path="avalon-framework-api-4.3.1.jar"/>
   <resource-root path="avalon-framework-impl-4.3.1.jar"/>
   <resource-root path="commons-codec-1.10.jar"/>
   <resource-root path="commons-io-2.4.jar"/>
   <resource-root path="commons-lang3-3.4.jar"/>
   <resource-root path="commons-logging-1.1.3.jar"/>
   <resource-root path="docx4j-3.3.1.jar"/>
   <resource-root path="guava-19.0.jar"/>
   <resource-root path="httpclient-4.5.2.jar"/>
   <resource-root path="httpcore-4.4.4.jar"/>
   <resource-root path="jackson-annotations-2.7.0.jar"/>
   <resource-root path="jackson-core-2.7.3.jar"/>
   <resource-root path="jackson-databind-2.7.3.jar"/>
   <resource-root path="jaxb-svg11-1.0.2.jar"/>
   <resource-root path="lorem-2.0.jar"/>
   <resource-root path="mbassador-1.2.4.2.jar"/>
   <resource-root path="serializer-2.7.2.jar"/>
   <resource-root path="stringtemplate-3.2.1.jar"/>
   <resource-root path="wmf2svg-0.9.8.jar"/>
   <resource-root path="xalan-2.7.2.jar"/>
   <resource-root path="xmlgraphics-commons-2.1.jar"/>
   <resource-root path="docx4j-ImportXHTML-3.3.1.jar"/>
</resources>

<dependencies>
   <module name="org.slf4j"/> 
   <module name="org.antlr"/>
   <module name="sun.jdk"/>
   <system export="true">
    <paths>
        <path name="com/sun/xml/internal/bind/marshaller"/>
    </paths>
   </system>    
   <module name="javax.xml.bind.api"/>  
   <module name="javax.api"/>               
   <module name="com.sun.xml.bind" />
</dependencies>
</module>

jboss-deployment-structure.xml for EAR:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.3">
   <sub-deployment name="Be.jar">
      <dependencies>
         <module name="com.sun.xml.bind" />
         <module name="org.docx4j" export="true" />
     </dependencies>
   </sub-deployment>
</jboss-deployment-structure>