users@glassfish.java.net

GF v3.1 not reading JAX-RS Application class

From: CasMeiron <casmeiron_at_gmail.com>
Date: Wed, 1 Sep 2010 13:19:43 -0300

Hi guys,

I'm tryin' a simple test case for JAX-RS, without using web.xml (I have it
but nothing on it).

I've created the follow class:

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

@ApplicationPath(RestApplicationConfig.REST_APPLICATION_PATH)
public class RestApplicationConfig extends Application {
 public static final String REST_APPLICATION_PATH = "rest";
 }

And then I've created the follow resource:

@Path("/hello")
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Stateless
public class TestResource {
 @GET
 public String hello( ) {
return "hello world!";
}

}

I can deploy the war with no problems but it seems that the rest context is
not created, I always get:

HTTP Status 404 -
------------------------------

*type* Status report

*message*

*description*The requested resource () is not available.
Any thoughts? I think this should work.

Thanks in advance.

-------------------------------
Paulo Reis