FIXED,
I change javax.ws.rs.ext.MessageBodyWriter file
*from:* [MY_WAR]/META-INF/services (META-INF of MY_WAR)
*to:* [MY_WAR]/WEB-INF/lib/some.jar -> /META-INF/services (META-INF of
some.jar on MY_WAR)
and works fine!
note: Jersey ignores /META-INF/services/ of WAR files
Thank you
On Jan 8, 2008 4:39 PM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
> Jose Antonio Illescas del Olmo wrote:
> > Thank you Paul, but after add these two lines (to
> > [MY_WAR]/META-INF/services/javax.ws.rs.ext.MessageBodyWriter file):
> >
> > es.rbcdexia.rest.provider.XMLProvider
> > es.rbcdexia.rest.provider.TXTProvider
> >
>
> Can you share the code of the isReadable and isWriteable methods for the
> above classes?
>
> I have just added some log statements when searching and caching the
> providers. It is in the latest build. Could you try with the latest
> build and see if you get a log that includes your classes, you should
> see text like the following:
>
> Searching for providers that implement: interface
> javax.ws.rs.ext.MessageBodyWriter
> Provider found: class
> com.sun.ws.rest.impl.provider.entity.StringProvider
> Provider found: class
> com.sun.ws.rest.impl.provider.entity.ByteArrayProvider
> Provider found: class
> com.sun.ws.rest.impl.provider.entity.FileProvider
> Provider found: class
> com.sun.ws.rest.impl.provider.entity.InputStreamProvider
> Provider found: class
> com.sun.ws.rest.impl.provider.entity.DataSourceProvider
> Provider found: class
> com.sun.ws.rest.impl.provider.entity.MimeMultipartProvider
> Provider found: class
> com.sun.ws.rest.impl.provider.entity.ViewTypeProvider
>
> Paul.
>
> > I obtain same error...
> >
> > 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)
> >
> >
> > note: both Provider classes are stored in
> [MY_WAR]/WEB-INF/lib/some.jar
> >
> > On Jan 8, 2008 1:44 PM, Paul Sandoz <Paul.Sandoz_at_sun.com
> > <mailto:Paul.Sandoz_at_sun.com>> wrote:
> >
> > Hi Jose,
> >
> > You need to add the fully qualified class name of your class to the
> > file:
> >
> > javax.ws.rs.ext.MessageBodyWriter
> >
> > that resides in the directory:
> >
> > META-INF/services
> >
> > of your application.
> >
> > For more details see the EntityProvider example.
> >
> > For 0.6 we will try to improve this so that such writers and readers
> > will be picked up automatically (just like root resource classes)
> and
> > you no longer need to use META-INF/services.
> >
> > Paul.
> >
> > Jose Antonio Illescas del Olmo wrote:
> > > 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?
> > >
> > >
> >
> > --
> > | ? + ? = To question
> > ----------------\
> > Paul Sandoz
> > x38109
> > +33-4-76188109
> >
> >
>
> --
> | ? + ? = To question
> ----------------\
> Paul Sandoz
> x38109
> +33-4-76188109
>