by SenthilKuttuva » Mon Feb 25, 2019 1:11 pm
Hello Jason/Team,
Your help would be appreciated as I am new to docx4j and trying to use to manipulate word documents. I am not sure whether it supports below vendor and version.
java.vendor=IBM Corporation
02/19/2019 12:55:44 INFO (Context) - java.version=1.8.0_191
When I tried to debug for null pointer exception, I see class not found exception is occurring from below stack trace.
02/20/2019 12:55:45 WARN (NamespacePrefixMapperUtils) - property "com.sun.xml.bind.namespacePrefixMapper" must be an instance of type com.sun.xml.bind.marshaller.NamespacePrefixMapper, not org.docx4j.jaxb.NamespacePrefixMapperSunInternal .. trying RI.
02/20/2019 12:55:45 ERROR (NamespacePrefixMapperUtils) - JAXB: neither Reference Implementation nor Java 6 implementation present?
java.lang.NoClassDefFoundError: com.sun.xml.bind.marshaller.NamespacePrefixMapper
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:379)
at com.ibm.ws.classloading.internal.AppClassLoader.definePackageAndClass(AppClassLoader.java:353)
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:277)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:925)
at java.lang.ClassLoader.loadClass(ClassLoader.java:870)
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:512)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:472)
at java.lang.ClassLoader.loadClass(ClassLoader.java:853)
at org.docx4j.jaxb.NamespacePrefixMapperUtils.tryUsingRI(NamespacePrefixMapperUtils.java:105)
at org.docx4j.jaxb.NamespacePrefixMapperUtils.getPrefixMapper(NamespacePrefixMapperUtils.java:84)
at org.docx4j.jaxb.Context.<clinit>(Context.java:117)
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:733)
at org.docx4j.openpackaging.io3.Load3.get(Load3.java:134)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:462)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:379)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:345)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:310)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:180)
So I tried adding jaxb-impl dependency but I see now its showing different error with property exception. I am not sure I am going in a right direction. Please advise.
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.1</version>
</dependency>
02/20/2019 18:49:30 INFO (Context) - Implementation-Title : JAXB Reference Implementation
02/20/2019 18:49:30 INFO (Context) - Build-Id : hudson-jaxb-ri-2.2-63
02/20/2019 18:49:30 INFO (Context) - Implementation-Version : 2.2.2
02/20/2019 18:49:30 INFO (Context) - Specification-Vendor : Oracle Corporation
02/20/2019 18:49:30 INFO (Context) - Specification-Title : Java Architecture for XML Binding
02/20/2019 18:49:30 INFO (Context) - Implementation-Vendor-Id : com.sun
02/20/2019 18:49:30 INFO (Context) - Class-Path : jaxb-api.jar activation.jar jsr173_1.0_api.jar jaxb1-impl.jar
02/20/2019 18:49:30 INFO (Context) - Manifest-Version : 1.0
02/20/2019 18:49:30 INFO (Context) - Implementation-Vendor : Oracle Corporation
02/20/2019 18:49:30 INFO (Context) - Ant-Version : Apache Ant 1.7.1
02/20/2019 18:49:30 INFO (Context) - Extension-Name : com.sun.xml.bind
02/20/2019 18:49:30 INFO (Context) - Created-By : 1.5.0_22-b03 (Sun Microsystems Inc.)
02/20/2019 18:49:30 INFO (Context) - Specification-Version : 2.2.2
02/20/2019 18:49:30 INFO (Context) - Found JAXB reference implementation in wsjar:file:/usr/WebSphere/wlp/usr/servers/ASCS/apps/expanded/blcsweb-ear.ear/blcsweb-war-1.0.0-SNAPSHOT.war/WEB-INF/lib/jaxb-impl-2.2.2.jar!/META-INF/MANIFEST.MF
02/20/2019 18:49:30 INFO (Context) - Implementation-Version : 2.2.2-hudson-jaxb-ri-2.2-63-
02/20/2019 18:49:30 DEBUG (ResourceUtils) - Attempting to load: org/docx4j/wml/jaxb.properties
02/20/2019 18:49:30 DEBUG (ResourceUtils) - Trying Thread.currentThread().getContextClassLoader()
02/20/2019 18:49:30 DEBUG (ResourceUtils) - Not using MOXy, since no resource: org/docx4j/wml/jaxb.properties
02/20/2019 18:49:30 DEBUG (Context) - No MOXy JAXB config found; assume not intended..
02/20/2019 18:49:30 DEBUG (Context) - org/docx4j/wml/jaxb.properties not found via classloader.
02/20/2019 18:49:30 WARN (NamespacePrefixMapperUtils) - property "com.sun.xml.bind.namespacePrefixMapper" must be an instance of type com.sun.xml.bind.marshaller.NamespacePrefixMapper, not org.docx4j.jaxb.NamespacePrefixMapperSunInternal .. trying RI.
02/20/2019 18:49:30 ERROR (NamespacePrefixMapperUtils) - JAXB: neither Reference Implementation nor Java 6 implementation present?
javax.xml.bind.PropertyException: property "com.sun.xml.bind.namespacePrefixMapper" must be an instance of type com.sun.xml.bind.marshaller.NamespacePrefixMapper, not org.docx4j.jaxb.NamespacePrefixMapper
at com.sun.xml.bind.v2.runtime.MarshallerImpl.setProperty(MarshallerImpl.java:511)
at com.ibm.xml.xlxp2.jaxb.marshal.MarshallerImpl.setProperty(MarshallerImpl.java:316)
at org.docx4j.jaxb.NamespacePrefixMapperUtils.tryUsingRI(NamespacePrefixMapperUtils.java:105)
at org.docx4j.jaxb.NamespacePrefixMapperUtils.getPrefixMapper(NamespacePrefixMapperUtils.java:84)
at org.docx4j.jaxb.Context.<clinit>(Context.java:117)
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:733)
at org.docx4j.openpackaging.io3.Load3.get(Load3.java:134)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:462)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:379)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:345)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:310)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:180)
Thanks,
Senthil