users@jersey.java.net

[Jersey] Debugging Moxy Feature

From: Pascal Klink <pascal.klink_at_web.de>
Date: Tue, 1 Apr 2014 20:48:58 +0200

Hi everyone,

I'm currently trying to enable the Moxy JSON Provider for my Jersey REST-Endpoints. So first some words to my setup I want to make Moxy work in:

I'm running a Grizzly HttpServer to which I register HttpHandlers with Jersey. I'm creating the Handlers from Application instances in which I provide the instantiated endpoints as Singeltons. I'm doing this because I'm running in an OSGI environment where I publish my endpoints as Services to the Server which runs as a seperate bundle.

So what I've done until now is including the jersey-media-moxy dependency in my bundle (as explained in the tutorial). Because I was not sure that jersey would correctly recognize the Moxy features in the OSGi environment (I'm everything else than an expert when it comes to classloading behaviour in OSGI environments) I debugged the creation of the HttpHandler and it seems that Jersey correctly loads the feature. At least instances of "org.glassfish.jersey.moxy.json.MoxyJsonFeature" and "org.glassfish.jersey.moxy.json.internal.ConfigurableMoxyJsonProvider" are contained in the runtimeConfig of the GrizzlyHttpContainer.

The problem is that when I try to load data from a database using my REST service, a 500 Status Code is returned. But there is no Error Message in the Response of Grizzly and I could not find any log entries in the OSGI log. So I tried to debug the handling of the Request but with all those Threads created with inner Classes being run, it's not that easy. And in the Classes mentioned above I cannot find any method which seems to do the processing.

So could anybody tell me where I have to start debugging in order to see the (un)marshalling of the Request/Response content done by Moxy? I think from there I would be able to solve the problem myself.

Greetings,
Pascal