users@jersey.java.net

Re: [Jersey] Problem with ServletContainer - Jersey

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 18 Mar 2009 16:29:40 +0100

Hi Guilherme,

On Mar 18, 2009, at 4:17 PM, Guilherme Melo e Maranhão wrote:

> Hi,
>
> I'm very new to Rest/Jersey and had some problems deploying my app
> in Tomcat. I set my jersey servlet in web.xml like this:
> <servlet-class>
> com.sun.jersey.spi.container.servlet.ServletContainer
> </servlet-class>
>

Can you send your:

- complete web.xml;

- tomcat log; and

- your resource class.


> but the container does not find the resource when it is acessed.

Are there any errors in the tomcat log? what URIs are you using to
access the resources.


> I've put in WEB-INF/lib the jersey-bundle-1.0.2.jar, wich has the
> servletContainer.
>

What are other jars files are in the WEB-INF/lib ?

See the dependencies for more details:

   https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-1.0.2/jersey/dependencies.html

For documentation on deployment using ServletContainer see:

   https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-1.0.2/api/jersey/com/sun/jersey/spi/container/servlet/ServletContainer.html
   http://wikis.sun.com/display/Jersey/Overview+of+JAX-RS+1.0+Features#OverviewofJAX-RS1.0Features-DeployingaRESTfulWebservice

> Do u know what's wrong? Is there anything else i must set to run
> correctly?
>
> I've read an article that suggest to include two init-param to the
> ServletContainer, wich are
> - com.sun.ws.rest.config.feature.Redirect
> - com.sun.ws.rest.config.feature.ImplicitViewables
>
> but they aren't in jersey-bundle-1.0.2.jar !!
>

What do you mean by "aren't in" ?

See:

   https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-1.0.2/api/jersey/com/sun/jersey/api/core/ResourceConfig.html
   https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-1.0.2/api/jersey/com/sun/jersey/api/core/ResourceConfig.html
#FEATURE_REDIRECT
   https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-1.0.2/api/jersey/com/sun/jersey/api/core/ResourceConfig.html
#FEATURE_IMPLICIT_VIEWABLES


> Do they must be declared?
>

No, they are not required.

Paul.