问题
Hi I have developed the web application to marshall and unmarshall using JAXB. The web application is working in tomcat without any issues. But when I tried in Websphere 7.0.0.13 its returning null object.Please help me on this issue.
回答1:
I had the same problem. Under this link is solution that help me.
What i did:
1. In the administrative console, click Applications > Application Types > WebSphere enterprise applications > app-name > Class loading and update detection.
2. Under Class reloading options, select Override class reloading settings for web and EJB modules .
3. Under Class loader order, select Class loader order property to Classes loaded with local class loader first (parent last).
4. Click OK, and then Save to save your changes.
After that:
1. In the Administration Console select Servers
2. Expand Server Type and select* WebSphere application servers *
3. Click on the name of your server
4. Expand Java and Process Management and select* Process Definition.*
5. Under the Additional Properties section, click Java Virtual
Machine.
6. Scroll down and locate the textbox for Generic JVM arguments.
ADD: -Djavax.xml.bind.JAXBContext=com.sun.xml.internal.bind.v2.ContextFactory
In the end restar web server and cluster.
回答2:
WebSphere Application Server v7+ contains an optimized JAXB implementation that will often be used instead of the JAXB implementation that's built into the Java SDK. If you notice a difference in behaviour between WebSphere and Tomcat (or some other runtime) that is affecting your application, as a workaround you can often resolve the issue by setting the system property com.ibm.xml.xlxp.jaxb.opti.level=0
in WebSphere. Using this setting will cause the JAXB reference implemenation to be used for unmarshalling and marshalling instead of the WebSphere JAXB implementation.
More information on the com.ibm.xml.xlxp.jaxb.opti.level
system property is available here.
来源:https://stackoverflow.com/questions/34762565/jaxb-in-websphere