users@jersey.java.net

Deployment: provider recognized, but not instantiated?

From: Laird Nelson <ljnelson_at_gmail.com>
Date: Thu, 22 Apr 2010 12:07:09 -0400

Following Paul's advice, for testing anyway, I now have a war file
without a web.xml, and various provider classes in jars in the
WEB-INF/lib directory. I also have an empty subclass of
javax.ws.rs.core.Application that is annotated with @ApplicationPath.

When I deploy this to Glassfish 3, I can see from the logs that my
provider classes are found, but logging output that I would expect to
see from them is never shown, and when it comes time to find a message
body writer, I get the following error:

[#|2010-04-22T10:12:08.796-0400|SEVERE|glassfish3.0|com.sun.jersey.spi.container.ContainerResponse|_ThreadID=30;_ThreadName=Thread-1;|A
message body writer for Java type, class java.util.ArrayList, and MIME
media type, application/xml, was not found|#]

My resource class does indeed return an ArrayList<PersonEntity>.

The message body writer which I intend to have handle everything never
seems to be constructed, but is found:

[#|2010-04-22T10:12:07.578-0400|INFO|glassfish3.0|com.sun.jersey.server.impl.application.DeferredResourceConfig|_ThreadID=30;_ThreadName=Thread-1;|Instantiating
the Application class, named com.jenzabar.ngp.war.test.Application.
The following root resource and provider classes are registered:
[class com.jenzabar.ngp.smartgwt.jaxrs.RestDataSourceAdapter, class
com.jenzabar.ngp.constituent.jaxrs.PersonResource]|#]

My RestDataSourceAdapter is annotated like this:
@Provider
@Produces("application/xml")
public class RestDataSourceAdapter implements MessageBodyWriter<Object> {
//...
}

I have logging messages on entry, exit of every method. No logging is
output. There is no indication that this message body writer is ever
constructed.

What have I done wrong?

Best,
Laird