users@jersey.java.net

which version of JAXB works with jersey-json's JSONJAXBContext with natural format?

From: James Strachan <james.strachan_at_gmail.com>
Date: Fri, 13 Feb 2009 17:43:57 +0000

When using the natural() format (which looks like being the one you're
supposed to use right?) I get this exception using 2.1 and 2.1.6 of
JAXB impl

13-Feb-2009 17:37:05 com.sun.jersey.core.spi.component.ProviderFactory
_getComponentProvider
SEVERE: The provider class, class
org.apache.camel.rest.util.JAXBContextResolver, could not be
instantiated
javax.xml.bind.JAXBException: property "retainReferenceToInfo" is not supported
        at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:63)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211)
        at javax.xml.bind.ContextFinder.find(ContextFinder.java:372)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
        at com.sun.jersey.api.json.JSONJAXBContext.<init>(JSONJAXBContext.java:256)
        at org.apache.camel.rest.util.JAXBContextResolver.<init>(JAXBContextResolver.java:50)


The work around is to avoid using this

        JSONConfiguration.Builder builder = JSONConfiguration.natural();

as the samples do, but use another one of the deprecated formats like

        JSONConfiguration.Builder builder = JSONConfiguration.mapped();

I just wondered is this a version clash? (I'm using Java 5 BTW - maybe
noone has seen it as it works with the Java 6's JAXB impl?).

Not a huge biggie - just wondered going forward what version of JAXB
impl should be used with Java 5 when using the preferred JSON/JAXB
configuration

-- 
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://fusesource.com/