users@glassfish.java.net

Re: GF v3.1 not reading JAX-RS Application class

From: Ludovic Champenois <ludovic.champenois_at_oracle.com>
Date: Wed, 01 Sep 2010 14:40:11 -0700

  On 9/1/10 9:19 AM, CasMeiron wrote:
> Hi guys,
>
> I'm tryin' a simple test case for JAX-RS, without using web.xml (I
> have it but nothing on it).

Nothing is something..., especially the version!!!
Is it a Web.xml 3.0 or older? If older, I am not sure it would work.
Check for web-app_3_0
<?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">
</web-app>

Or delete it entirely...
Ludo
>
> 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
>
>