users@glassfish.java.net

Re: How to upgrade JAXB jars for Glassfish 3.1.2 to fix jersey json natural notation with JAXB

From: Farrukh Najmi <farrukh_at_wellfleetsoftware.com>
Date: Thu, 16 Feb 2012 08:48:13 -0500

I found the solution from Pavel here:

http://jersey.576304.n2.nabble.com/JSON-natural-on-GF-3-1-b40-td5977358.html

Here is a summary of the steps...

cd ~/glassfish-3.1.2/glassfish/modules
wget
http://download.java.net/maven/2/com/sun/xml/bind/jaxb-osgi/2.2.3/jaxb-osgi-2.2.3.jar

cd ~/glassfish-3.1.2/glassfish/modules/endorsed
wget
http://download.java.net/maven/2/javax/xml/bind/jaxb-api-osgi/2.2.3/jaxb-api-osgi-2.2.3.jar

Restart Glassfish after that and all is well.

On 02/15/2012 09:17 PM, Farrukh Najmi wrote:
> Hi Guys,
>
> I have run into the same or similar issue as:
>
> http://www.java.net/node/694669
>
> See error trace at the bottom...
>
> I cannot determine how I can upgrade my Glassfish 3.1.2 to use
> jaxb-api and jaxb-impl 2.2.3. Can some one please tell me the easiest
> way to do this. Thanks very much.
>
> [#|2012-02-15T20:39:51.064-0500|SEVERE|glassfish3.1.2|com.sun.jersey.api.json.JSONConfiguration|_ThreadID=10;_ThreadName=Thread-2;|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!|#]
>
> [#|2012-02-15T20:39:51.066-0500|SEVERE|glassfish3.1.2|com.sun.jersey.core.spi.component.ProviderFactory|_ThreadID=10;_ThreadName=Thread-2;|The
> provider class, class
> org.freebxml.omar.server.interfaces.rest.JAXBContextResolver, could
> not be instantiated. 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:447)
> at
> org.freebxml.omar.server.interfaces.rest.JAXBContextResolver.<init>(JAXBContextResolver.java:52)
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at
> java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> at java.lang.Class.newInstance0(Class.java:355)
> at java.lang.Class.newInstance(Class.java:308)
> at
> com.sun.jersey.core.spi.component.ComponentConstructor._getInstance(ComponentConstructor.java:192)
> at
> com.sun.jersey.core.spi.component.ComponentConstructor.getInstance(ComponentConstructor.java:179)
> at
> com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:166)
> at
> com.sun.jersey.core.spi.component.ProviderFactory._getComponentProvider(ProviderFactory.java:159)
> at
> com.sun.jersey.core.spi.component.ioc.IoCProviderFactory._getComponentProvider(IoCProviderFactory.java:93)
> at
> com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:153)
> at
> com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:251)
> at
> com.sun.jersey.core.spi.component.ProviderServices.getProviders(ProviderServices.java:148)
> at
> com.sun.jersey.core.spi.factory.ContextResolverFactory.init(ContextResolverFactory.java:83)
> at
> com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1271)
> at
> com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:169)
> at
> com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:775)
> at
> com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:771)
> at
> com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
> at
> com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:771)
> at
> com.sun.jersey.spi.spring.container.servlet.SpringServlet.initiate(SpringServlet.java:117)
> at
> com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:318)
> at
> com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:609)
> at
> com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:210)
> at
> com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:373)
> at
> com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:556)
>
>


-- 
Regards,
Farrukh Najmi
Web: http://www.wellfleetsoftware.com