The User's Guide [1] mentions the list of JARs required for non-Maven projects to support JSON serialization of JAXB beans.
I'm investigating a problem with a project that bundles Jersey w/Jetty and a recent addition to the JAXBContextResolver used in the project to add support for NATURAL notation is now resulting in the following error message:
INFO: Initiating Jersey application, version 'Jersey: 1.1.5.1 03/10/2010 02:41 PM'
Feb 25, 2013 10:40:50 PM com.sun.jersey.api.json.JSONConfiguration natural
SEVERE: NATURAL JSON notation configured, but JAXB RI 2.1.10 not found. For the recent builds to get this working correc
tly, you need even at least JAXB version 2.1.12. Please add it to your classpath!
Feb 25, 2013 10:40:50 PM com.sun.jersey.core.spi.component.ProviderFactory __getComponentProvider
SEVERE: The provider class, class com.foo.JAXBContextResolver, could not be instantiate
d. Processing will continue but the class will not be utilized
java.lang.RuntimeException: NATURAL JSON notation configured, but JAXB RI 2.1.10 not found. For the recent builds to get
this working correctly, you need even at least JAXB version 2.1.12. Please add it to your classpath!
at com.sun.jersey.api.json.JSONConfiguration.natural(JSONConfiguration.java:378)
As you can see this is a relatively old version of Jersey in play here. I looked at the old version of the User's guide [1] that covers it to double check the required dependencies for this feature and it looks like the project already has everything. It bundles jersey-bundle-1.1.5.1.jar, asm-3.1.jar, jsr311-api-1.1.jar, jackson-core-asl-1.1.1.jar, and jettison-1.1.jar and they appear on the class path at runtime.
It does not explicitly bundle jaxb-impl.jar, jaxb-api.jar, activation.jar and stax-api.jar as these should be picked up from the 1.7.0_03 JDK/JRE should they not?
I added -verbose:class to my VM options and verified that at start up and up to the error message it is pulling all the JAXB classes from the 1.7 rt.jar.
This feels very similar to [2] though this project is using Jetty it bundles all its libs outside of jetty.home and they are listed on the java cmd line that invokes a class w/a MAIN which bootstraps the jetty environment so they end up in the classloader that starts jetty vs the webapp class loader (not my doing :-).
Any thoughts on what could going on here?
Thanks,
-Noah
[1] -
http://jersey.java.net/nonav/documentation/1.1.5/user-guide.html#chapter_deps
[2] -
http://stackoverflow.com/questions/10032032/jaxb-issues-under-java-7-it-says-it-cant-find-ri-2-1-0