I am migrating a SOAP WS application from WL10 to WL12. We had an issue with how JAXB interprets this XML element:
<sch:testVar xsi:nil="true" xmlns:xsi="http://ift.tt/ra1lAU"/>
In WL10, JAXB correctly marshalls this to a null object. In WL12, JAXB converts this to an empty String.
After a lot of research about classpaths and data binding providers, we finally traced down the problem... Log4J.
We are using Maven and adding the dependency Log4J 1.2.16 changes everything. When Log4J is in the application, the XML above renders as an empty String. Removing only the Log4J dependency from the pom, JAXB renders the XML above as null.
Does anyone know why Log4J would impact JAXB?
A couple notes:
- We are aware of how WL12 changed JAXB implementations. We spent several days changing classpaths and dependencies.
- We are working with a very stripped down application. Our other dependencies include Spring (core, context-support, web, tx, ws-core) 3.1.1. That's it.
- Our test endpoint doesn't do anything other than output what the object is.
- Log4J2 works fine.
- Our Log4J 1.2.16 dependency pulls in no other dependencies with it
The dependency tree from the maven build is below:
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ RJM-Training-SOAP-WS ---
[INFO] com.mycompany:RJM-Training-SOAP-WS:war:0.0.1-SNAPSHOT
[INFO] +- org.springframework:spring-core:jar:3.1.1.RELEASE:compile
[INFO] | +- org.springframework:spring-asm:jar:3.1.1.RELEASE:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.springframework:spring-context-support:jar:3.1.1.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:3.1.1.RELEASE:compile
[INFO] | \- org.springframework:spring-context:jar:3.1.1.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-web:jar:3.1.1.RELEASE:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-tx:jar:3.1.1.RELEASE:compile
[INFO] | \- org.springframework:spring-aop:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework.ws:spring-ws-core:jar:2.1.2.RELEASE:compile
[INFO] | +- org.springframework.ws:spring-xml:jar:2.1.2.RELEASE:compile
[INFO] | +- org.springframework:spring-oxm:jar:3.1.3.RELEASE:compile
[INFO] | | \- commons-lang:commons-lang:jar:2.5:compile
[INFO] | +- org.springframework:spring-webmvc:jar:3.1.3.RELEASE:compile
[INFO] | \- wsdl4j:wsdl4j:jar:1.6.1:compile
[INFO] \- log4j:log4j:jar:1.2.16:compile
The JAXB context we are using is below:
[user@server logs]$ grep JAXBContext WSServer01.log.out
[Loaded javax.xml.bind.JAXBContext from /opt/weblogic/wl12.1.2.0/wlserver/../oracle_common/modules/endorsed/javax-xml-bind.jar]
[Loaded com.sun.xml.bind.v2.runtime.JAXBContextImpl from file:/opt/weblogic/wl12.1.2.0/oracle_common/modules/com.sun.xml.bind.jaxb-impl_2.2.jar]
[Loaded com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder from file:/opt/weblogic/wl12.1.2.0/oracle_common/modules/com.sun.xml.bind.jaxb-impl_2.2.jar]
[Loaded com.sun.xml.bind.v2.runtime.JAXBContextImpl$5 from file:/opt/weblogic/wl12.1.2.0/oracle_common/modules/com.sun.xml.bind.jaxb-impl_2.2.jar]
[Loaded com.sun.xml.bind.v2.runtime.JAXBContextImpl$6 from file:/opt/weblogic/wl12.1.2.0/oracle_common/modules/com.sun.xml.bind.jaxb-impl_2.2.jar]
[Loaded com.sun.xml.bind.v2.runtime.JAXBContextImpl$3 from file:/opt/weblogic/wl12.1.2.0/oracle_common/modules/com.sun.xml.bind.jaxb-impl_2.2.jar]
[Loaded com.sun.xml.bind.v2.runtime.JAXBContextImpl$7 from file:/opt/weblogic/wl12.1.2.0/oracle_common/modules/com.sun.xml.bind.jaxb-impl_2.2.jar]
[Loaded com.sun.xml.bind.v2.runtime.JAXBContextImpl$1 from file:/opt/weblogic/wl12.1.2.0/oracle_common/modules/com.sun.xml.bind.jaxb-impl_2.2.jar]
[Loaded com.sun.xml.bind.v2.runtime.JAXBContextImpl$2 from file:/opt/weblogic/wl12.1.2.0/oracle_common/modules/com.sun.xml.bind.jaxb-impl_2.2.jar]
I went into the code and logged the JAXB class used. It is the same in both instances.
file:/opt/weblogic/wl12.1.2.0/oracle_common/modules/endorsed/javax-xml-bind.jar!/javax/xml/bind/JAXBContext.class
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire