users@jersey.java.net

[Jersey] Re: _at_ApplicationPath not working

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Fri, 14 Jan 2011 10:54:35 +0100

On Jan 14, 2011, at 5:18 AM, Gili wrote:

>
> Hi,
>
> I am trying to deploy a JAX-RS application using Netbeans 7.0 (dev
> build),
> Glassfish 3.1.1 and Jersey 1.4.
>

3.1.1? do you mean 3.1?


> If I add the following web.xml file to my project everything works
> fine:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
> version="3.0">
> <servlet>
> <servlet-name>foo.ApplicationConfig</servlet-name>
> <load-on-startup>1</load-on-startup>
> </servlet>
> <servlet-mapping>
> <servlet-name>foo.ApplicationConfig</servlet-name>
> <url-pattern>/*</url-pattern>
> </servlet-mapping>
> <session-config>
> <session-timeout>
> 30
> </session-timeout>
> </session-config>
> </web-app>
>
> If, however, I remove web.xml and define the following class then my
> resource doesn't get loaded:
>
> @ApplicationPath("/*")
> public class ApplicationConfig extends DefaultResourceConfig
> {
> @Override
> public Set<Class<?>> getClasses()
> {
> return Sets.<Class<?>>newHashSet(DoctorsResource.class);
> }
> }
>
> What am I doing wrong?
>

Not sure, from what say all looks correct, can send a zip of a maven
project or NB project that reproduces the issue?

Paul.