users@jersey.java.net

Custom _at_Provider

From: Jose Antonio Illescas del Olmo <jose.illescas_at_gmail.com>
Date: Tue, 8 Jan 2008 13:10:50 +0100

I trying to do a custom Provider: for java.sql.Date and mime
"application/xml"

    note: my environment is: tomcat-6, jdk-1.5 and jersey-0.5 (8 jan 2008)

    My Class (in classpath) is annotated as:

@ProduceMime("application/xml")
@ConsumeMime("application/xml")
@Provider
public class XMLProvider implements MessageBodyWriter<Object>,
MessageBodyReader<Object>{

The error is...

    java.lang.IllegalArgumentException: A message body writer for Java
type, class java.sql.Date, and MIME media type, application/xml, was
not found
        com.sun.ws.rest.impl.provider.ProviderFactoryImpl.createMessageBodyWriter(ProviderFactoryImpl.java:181)
        com.sun.ws.rest.spi.container.AbstractContainerResponse.writeEntity(AbstractContainerResponse.java:245)
        com.sun.ws.rest.spi.container.AbstractContainerResponse.writeEntity(AbstractContainerResponse.java:223)
        com.sun.ws.rest.impl.container.servlet.HttpResponseAdaptor.commitAll(HttpResponseAdaptor.java:125)
        com.sun.ws.rest.spi.container.servlet.ServletContainer.service(ServletContainer.java:130)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


Any idea?