users@jersey.java.net

Re: [Jersey] using Jersey in Jetty

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 10 Feb 2009 11:35:25 +0100

Hi Amir,

Note that i am not familiarly with Jetty configuration in terms of
deployment of a web application. I need more information:

1) What is the context path that the app is deployed at: "myWeb" ?

2) Can you access the welcome files?

3) What is the logged output from Jetty? is the Jersey application
being deployed? does the logged
     output state that is has found root resource classes in the
package you declared? (i presume it does).

4) What are @Path on your root resource classes and sub-resource
locator methods? Does the path
      "employees/asdf/asdf" match to a resource class?

Paul.

On Feb 9, 2009, at 10:09 PM, Amir Pourteymour wrote:

> Hi,
> I am planning to configure Jersey inside Jetty, so here is the block
> I added to web.xml of my project:
>
> I was wondering if my configuration is right, because I am getting
> HTTP ERROR 404.
>
> HTTP ERROR: 404
>
> NOT_FOUND
> RequestURI=/myWeb/rest/employees/asdf/asdf
>
>
>
> ===============web.xml========
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <web-app id="WebApp_ID" version="2.4"
> xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
> "
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
> ">
> <display-name>myWeb</display-name>
>
> <display-name>restSample</display-name>
> <servlet>
> <servlet-name>JerseyServlet</servlet-name>
> <servlet-
> class>com.sun.ws.rest.spi.container.servlet.ServletContainer</
> servlet-class>
> <init-param>
> <param-
> name>com.sun.jersey.config.property.resourceConfigClass</param-name>
> <param-
> value>com.sun.jersey.api.core.PackagesResourceConfig</param-value>
> </init-param>
> <init-param>
> <param-
> name>com.sun.jersey.config.property.packages</param-name>
> <param-value>com.myApp.rest</param-value>
> </init-param>
> <load-on-startup>1</load-on-startup>
> </servlet>
> <servlet-mapping>
> <servlet-name>JerseyServlet</servlet-name>
> <url-pattern>/rest/*</url-pattern>
> </servlet-mapping>
>
> <welcome-file-list>
> <welcome-file>index.html</welcome-file>
> <welcome-file>index.htm</welcome-file>
> <welcome-file>index.jsp</welcome-file>
> <welcome-file>default.html</welcome-file>
> <welcome-file>default.htm</welcome-file>
> <welcome-file>default.jsp</welcome-file>
> </welcome-file-list>
> </web-app>
>
> , after deploying myApp.rest, I would like to call my POST upon
> entering this address : http://localhost:8080/myWeb/rest/employees/...
>
>
> thanks,
> Amir