users@glassfish.java.net

GF 3.1.1: Jersey based RESTful WebServices

From: Bernhard Thalmayr <bernhard.thalmayr_at_painstakingminds.com>
Date: Tue, 28 Feb 2012 17:38:17 +0100

Hi experts,

I have a web-app which includes RESTful WebServices based on Jersey.

When I deploy the application within GF 3.1.1 I get the following exception ...


[#|2012-02-28T15:52:52.759+0100|INFO|glassfish3.1.1|com.sun.jersey.server.impl.application.WebApplicationImpl|_ThreadID=208;_ThreadName=Thread-2;|Initiating
Jersey application, version 'Jersey: 1.8 06/24/2011 12:17 PM'|#]

[#|2012-02-28T15:52:52.808+0100|INFO|glassfish3.1.1|com.sun.jersey.server.impl.application.DeferredResourceConfig|_ThreadID=208;_ThreadName=Thread-2;|Instantiated
the Application class com.sun.identity.rest.RestService|#]

[#|2012-02-28T15:52:53.052+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.container.web.com.sun.enterprise.web._vs.server|_ThreadID=208;_ThreadName=Thread-19;|WebModule[/opensso]StandardWrapper.Throwable
java.lang.NoClassDefFoundError: Could not initialize class
com.sun.jersey.core.header.MediaTypes
        at com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:182)
        at com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:176)
        at com.sun.jersey.core.spi.factory.MessageBodyFactory.init(MessageBodyFactory.java:162)
        at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1277)

I checked out Jersey 1.8 code from svn and this class is there ....

The Web Services is deployed as described in
'http://docs.oracle.com/cd/E19776-01/820-4867/ggnxs/index.html'.


Entry in web.xml

    <servlet>
        <servlet-name>ws</servlet-name>
        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
        <init-param>
            <param-name>javax.ws.rs.Application</param-name>
            <param-value>com.sun.identity.rest.RestService</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

What might cause this or where do I have to look at?

TIA,
Bernhard

-- 
IT-Consulting Bernhard Thalmayr
- Painstaking Minds -
83620 Vagen (Munich area)
Germany