users@jersey.java.net

[Jersey] How to debug 404 response from jersey server

From: Farrukh Najmi <farrukh_at_wellfleetsoftware.com>
Date: Wed, 28 Sep 2011 14:57:15 -0400

Looking at jersey server code its clear that log messages will not be
useful.

What is the best way to debug the cause of a jersey 404 response from a
jersey server?

Here is some info:

    * server base URI: http://localhost:9090
    * servlet context: /server
    * resource path: /rest/events/all


Here is my root resource class which is found by jersey server:

@Path("/rest/events")
@Produces("application/atom+xml")
public class MyResource {

     @Path("/rest/events/all")
     @GET
     @Produces("application/atom+xml")
     public Response allEventsGet() {
         ...
     }
}

Here is the jersey client code:

         Client c = Client.create();
         WebResource webResource = c.resource(server.BASE_URI +
"/server/rest/events/all");
         String s =
webResource.accept("application/atom+xml").get(String.class);

Here is the request logged by LoggingFilter:

1 > GET http://localhost:9090/server/rest/events/all

Here is the response logged by LoggingFilter:

INFO: 1 * Server out-bound response
1 < 404
1 <

TIA for your help.

On 09/28/2011 02:32 PM, Farrukh Najmi wrote:
> Hi Guys,
>
> This perhaps is an FAQ but I did not find any suitable answers in
> archives or in web search...
>
> I am developing a new jersey based server and my resource class method
> is not being called as expected when I hit the server using jersey
> client based test program.
>
> The "INFO: Root resource classes found" message indicates that my root
> resource is indeed found. I have checked to make sure that the
> @Produces matches the accept header and the path params are correct.
>
> So I am looking to run the server with jersey logging turned on
> maximally. I am not sure how to do that as there does not seem to be
> any jersey related logger in LogManager:
>
> LogManager.getLogManager().getLoggerNames();
>
> How can I programmatically or in config turn on jersey server logging
> to debug my problem?
>
> Note I already have LoggingFilter set for ContainerRequestFilters and
> ContainerResponseFilters.
>
> Thanks for your help.
>


-- 
Regards,
Farrukh Najmi
Web: http://www.wellfleetsoftware.com