users@jersey.java.net

Re: MessageBodyReader not found

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 04 Feb 2008 16:21:49 +0100

Hi Peter,

Not sure if you require the 'org.json' dependency as Jettison includes
that stuff.

IIRC another person on this list was having similar issues when using an
older version of Jettison that did not have the JSONException class.

Paul.

fjksl sdfmlsdfjlmk wrote:
> Hi Paul,
>
> Thank you for the fast response. This is my pom file :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project>
> <modelVersion>4.0.0</modelVersion>
> <groupId>be.theCompany</groupId>
> <artifactId>aWebServer</artifactId>
> <packaging>war</packaging>
> <name>aWebServer Maven Webapp</name>
> <version>1.0-SNAPSHOT</version>
> <url>http://maven.apache.org</url>
> <build>
> <finalName>aWebServer</finalName>
> <plugins>
> <plugin>
> <artifactId>maven-compiler-plugin</artifactId>
> <configuration>
> <source>1.5</source>
> <target>1.5</target>
> </configuration>
> </plugin>
> </plugins>
> </build>
> <repositories>
> <repository>
> <id>maven-repository.dev.java.net
> <http://maven-repository.dev.java.net></id>
> <name>Java.net <http://Java.net> Repository for Maven 1</name>
> <url>http://download.java.net/maven/1/</url>
> <layout>legacy</layout>
> </repository>
> <repository>
> <id>maven2-repository.dev.java.net
> <http://maven2-repository.dev.java.net></id>
> <name>Java.net <http://Java.net> Repository for Maven 2</name>
> <url>http://download.java.net/maven/2/</url>
> </repository>
> </repositories>
> <dependencies>
> <dependency>
> <groupId>junit</groupId>
> <artifactId>junit</artifactId>
> <version>4.4</version>
> <scope>test</scope>
> </dependency>
> <dependency>
> <groupId>javax.persistence</groupId>
> <artifactId>persistence-api</artifactId>
> <version>1.0</version>
> <scope>provided</scope>
> </dependency>
> <dependency>
> <groupId>org.apache.geronimo.specs</groupId>
> <artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
> <version>1.1.1</version>
> <scope>provided</scope>
> </dependency>
> <dependency>
> <groupId>org.json</groupId>
> <artifactId>json</artifactId>
> <version>20070829</version>
> </dependency>
> <dependency>
> <groupId>jersey</groupId>
> <artifactId>jersey</artifactId>
> <version>0.6-ea</version>
> </dependency>
> <dependency>
> <groupId>org.jvnet.staxex</groupId>
> <artifactId>stax-ex</artifactId>
> <version>1.2</version>
> </dependency>
> <dependency>
> <groupId>cglib</groupId>
> <artifactId>cglib-nodep</artifactId>
> <version>2.1_3</version>
> </dependency>
> <dependency>
> <groupId>javax.servlet</groupId>
> <artifactId>servlet-api</artifactId>
> <version>2.5</version>
> <scope>provided</scope>
> </dependency>
> <dependency>
> <groupId>org.apache.geronimo.specs</groupId>
> <artifactId>geronimo-jta_1.1_spec</artifactId>
> <version>1.1</version>
> <scope>provided</scope>
> </dependency>
> <dependency>
> <groupId>org.codehaus.jettison</groupId>
> <artifactId>jettison</artifactId>
> <version>1.0-RC2</version>
> </dependency>
> <dependency>
> <groupId>org.springframework</groupId>
> <artifactId>spring</artifactId>
> <version>2.5.1</version>
> </dependency>
> </dependencies>
> </project>
>
> I've installed the jersey and jax-rs manually. I have to say that I was
> initially using an older version of jettison., maybe that jar was still
> cached. I'll take a look at it tonight. Now I'm using the RC2 version.
>
> Thanks,
>
> Peter
>
> 2008/2/4, Paul Sandoz <Paul.Sandoz_at_sun.com <mailto:Paul.Sandoz_at_sun.com>>:
>
> Hi Peter,
>
> I am glad the new ComponentProvider and Servlet worked for you.
>
> Do you have the jettison-1.0-RC1.jar in your class path?
>
> If not you should get warnings at start up like those shown at the end
> of the email. Components for message body readers/writers are loaded
> dynamically as we want to have a very small set of required
> dependencies. See here for the description of optional dependencies [1].
>
> I don't know how to represent such optional dependencies with Maven.
> Should we have a set of profiles? I have to say that initally I used
> an older jettison. Maybe It's still somewher in glassfish's memory
> :-) I will try to look at it this evening. Currently it's jettison RC2
>
>
>
>
> Paul.
>
> [1]
> https://jersey.dev.java.net/source/browse/*checkout*/jersey/trunk/jersey/docs/dependencies.html
>
> [java] Feb 4, 2008 10:23:11 AM
> com.sun.ws.rest.spi.service.ServiceFinder$AbstractLazyIterator hasNext
> [java] WARNING: A dependent class,
> org/codehaus/jettison/json/JSONException, of the class
> com.sun.ws.rest.impl.provider.entity.JSONJAXBElementProvider
> implementing the provider interface javax.ws.rs.ext.MessageBodyReader is
> not found. The provider implementation is ignored.
> [java] Feb 4, 2008 10:23:11 AM
> com.sun.ws.rest.spi.service.ServiceFinder$AbstractLazyIterator hasNext
> [java] WARNING: A dependent class,
> org/codehaus/jettison/json/JSONException, of the class
> com.sun.ws.rest.impl.provider.entity.JSONArrayProvider implementing the
> provider interface javax.ws.rs.ext.MessageBodyReader is not found. The
> provider implementation is ignored.
> [java] Feb 4, 2008 10:23:11 AM
> com.sun.ws.rest.spi.service.ServiceFinder$AbstractLazyIterator hasNext
> [java] WARNING: A dependent class,
> org/codehaus/jettison/json/JSONException, of the class
> com.sun.ws.rest.impl.provider.entity.JSONObjectProvider implementing the
> provider interface javax.ws.rs.ext.MessageBodyReader is not found. The
> provider implementation is ignored.
>
> fjksl sdfmlsdfjlmk wrote:
> > Hi,
> >
> > I'm trying to make a smaller application using maven, spring, JPA and
> > off course JAX-RS.
> > The application is now pretty much comparable with the Bookmark
> example,
> > with the difference that I'm using the SpringServlet as described by
> > Paul Sandoz.
> > Which went all very fluent. When I then try curl for a "PUT"
> operation I
> > get this exception:
> >
> > com.sun.ws.rest.api.container.ContainerException: Exception injecting
> > parameters to Web resource method
> > at
> >
> com.sun.ws.rest.impl.model.method.dispatch.EntityParamDispatchProvider$EntityParamInInvoker.getParams(EntityParamDispatchProvider.java:79)
> > at
> >
> com.sun.ws.rest.impl.model.method.dispatch.EntityParamDispatchProvider$ResponseOutInvoker._dispatch(EntityParamDispatchProvider.java:122)
> > at
> >
> com.sun.ws.rest.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:66)
> > at
> >
> com.sun.ws.rest.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:104)
> > at
> >
> com.sun.ws.rest.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:65)
> > at
> >
> com.sun.ws.rest.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:83)
> > at
> >
> com.sun.ws.rest.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:55)
> > at
> >
> com.sun.ws.rest.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:83)
> > at
> >
> com.sun.ws.rest.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:49)
> > at
> >
> com.sun.ws.rest.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:349)
> > at
> >
> com.sun.ws.rest.spi.container.servlet.ServletContainer.service(ServletContainer.java:130)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
> > at
> >
> org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
> > at
> >
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:290)
> > at
> >
> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
> > at
> >
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
> > at
> >
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
> > at
> >
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
> > at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
> > at
> >
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
> > at
> >
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
> > at
> >
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
> > at
> >
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
> > at
> >
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
> > at
> >
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
> > at
> >
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
> > at
> >
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
> > at
> >
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
> > at
> >
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
> > at
> >
> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
> > at
> >
> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
> > at
> >
> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
> > at
> >
> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
> > at
> >
> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
> > at
> >
> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
> > at
> >
> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
> > at
> >
> com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)
> > at
> >
> com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
> > at
> >
> com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
> > Caused by: java.lang.IllegalArgumentException: A message body
> reader for
> > Java type, class org.json.JSONObject, and MIME media type,
> > application/json, was not found
> > at
> >
> com.sun.ws.rest.impl.application.MessageBodyFactory.getMessageBodyReader(MessageBodyFactory.java:134)
> > at
> >
> com.sun.ws.rest.spi.container.AbstractContainerRequest.getEntity(AbstractContainerRequest.java:201)
> > at
> >
> com.sun.ws.rest.impl.model.method.dispatch.EntityParamDispatchProvider$EntityExtractor.extract(EntityParamDispatchProvider.java:57)
> > at
> >
> com.sun.ws.rest.impl.model.method.dispatch.EntityParamDispatchProvider$EntityParamInInvoker.getParams(EntityParamDispatchProvider.java:73)
> > ... 38 more
> >
> > I'm using glassfish V2, Java 1.6_04 and I have to say that I'm a
> little
> > lost right now. So, this mailinglist seemed the best way to get some
> > help or tips in solving this exception.
> >
> > Kind regards,
> >
> > Peter
>
> --
> | ? + ? = To question
> ----------------\
> Paul Sandoz
> x38109
> +33-4-76188109
>
>