org.jboss.resteasy.core.NoMessageBodyWriterFoundFailure

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I think the following describes a bug as I expect a Resteasy service to handle a java.lang.String return type successfully. I am using Resteasy in a ServiceMix 4.4.0 deployment. The Rest service is exposed via OSGi and consumed by another OSGi bundle. I have attached the sample project source code. ******************** The following two method signatures when called via a Resteasy client will through an exception. See helloworld-integration-test/src/test/java/test/api/svc/HelloSvcTest.java ******************** * The method signatures that throw an exception: {code} @POST @Path( "/StandardGreeting" ) @Consumes( { "application/json", "text/json" } ) @Produces( { "application/json", "text/json" } ) @GZIP @Override public Response getStandardGreeting( GreetingRequest request ) { String value = "Hi " + request.getRecipientName() + "..." + " " + "How is it going?"; return Response.ok().entity( new String( value ) ).build(); } {code} {code} @POST @Path( "/SimpleHelloGreeting" ) @Consumes( { "application/json", "text/json" } ) @Produces( { "application/json", "text/json" } ) @GZIP @Override public String getSimpleHelloGreeting( GreetingRequest request ) { String value = "Hello " + request.getRecipientName() + "!!!"; return new String( value ); } {code} * Will throw the following exception: {code} 17:51:20,783 | ERROR | qtp628451228-74 | SynchronousDispatcher | 651 - helloworld-org-jboss-resteasy - 2.2.3.GA | Failed executing POST /service/StandardGreeting org.jboss.resteasy.core.NoMessageBodyWriterFoundFailure: Could not find MessageBodyWriter for response object of type: java.lang.String of media type: application/json at org.jboss.resteasy.core.ServerResponse.writeTo(ServerResponse.java:216)[651:helloworld-org-jboss-resteasy:2.2.3.GA] at org.jboss.resteasy.core.SynchronousDispatcher.writeJaxrsResponse(SynchronousDispatcher.java:579)[651:helloworld-org-jboss-resteasy:2.2.3.GA] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:500)[651:helloworld-org-jboss-resteasy:2.2.3.GA] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)[651:helloworld-org-jboss-resteasy:2.2.3.GA] at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)[651:helloworld-org-jboss-resteasy:2.2.3.GA] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)[651:helloworld-org-jboss-resteasy:2.2.3.GA] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)[651:helloworld-org-jboss-resteasy:2.2.3.GA] at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)[111:org.apache.geronimo.specs.geronimo-servlet_2.5_spec:1.1.2] at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:538)[99:org.eclipse.jetty.servlet:7.4.5.v20110725] at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:478)[99:org.eclipse.jetty.servlet:7.4.5.v20110725] at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:70)[113:org.ops4j.pax.web.pax-web-jetty:1.0.7] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:480)[101:org.eclipse.jetty.security:7.4.5.v20110725] at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:937)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:116)[113:org.ops4j.pax.web.pax-web-jetty:1.0.7] at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)[99:org.eclipse.jetty.servlet:7.4.5.v20110725] at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:871)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:72)[113:org.ops4j.pax.web.pax-web-jetty:1.0.7] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.eclipse.jetty.server.Server.handle(Server.java:346)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:589)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1065)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:823)[102:org.eclipse.jetty.http:7.4.5.v20110725] at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:220)[102:org.eclipse.jetty.http:7.4.5.v20110725] at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:535)[100:org.eclipse.jetty.io:7.4.5.v20110725] at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)[100:org.eclipse.jetty.io:7.4.5.v20110725] at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)[110:org.eclipse.jetty.util:7.4.5.v20110725] at java.lang.Thread.run(Thread.java:662)[:1.6.0_27] {code} * The JUnit tests that fail (helloworld-integration-test\src\test\java\test\api\svc\HelloSvcTest.java): {code} @SuppressWarnings( "static-method" ) @Test public void testGetStandardGreeting() { ClientRequest request = null; ClientResponse<String> response = null; try { GreetingRequest greetingRequest = new GreetingRequest(); greetingRequest.setRecipientName( "World" ); // // Make the Service Call // request = new ClientRequest( "http://localhost:8181/service/StandardGreeting" ); request.accept( MediaType.APPLICATION_JSON ); request.body( MediaType.APPLICATION_JSON, greetingRequest ); response = request.post( String.class ); // // Handle the Service Response // Assert.assertEquals( Response.Status.OK.getStatusCode(), response.getStatus() ); Assert.assertEquals( "Hi World... How is it going?", response.getEntity() ); } catch ( Exception e ) { throw new RuntimeException( e ); } finally { if ( null != response ) { response.releaseConnection(); } } } @SuppressWarnings( "static-method" ) @Test public void testGetSimpleHelloGreeting() { ClientRequest request = null; ClientResponse<String> response = null; try { GreetingRequest greetingRequest = new GreetingRequest(); greetingRequest.setRecipientName( "World" ); // // Make the Service Call // request = new ClientRequest( "http://localhost:8181/service/SimpleHelloGreeting" ); request.accept( MediaType.APPLICATION_JSON ); request.body( MediaType.APPLICATION_JSON, greetingRequest ); response = request.post( String.class ); // // Handle the Service Response // Assert.assertEquals( Response.Status.OK.getStatusCode(), response.getStatus() ); Assert.assertEquals( "Hello World!!!", response.getEntity() ); } catch ( Exception e ) { throw new RuntimeException( e ); } finally { if ( null != response ) { response.releaseConnection(); } } } {code}
    via by Mark S,
  • NoMessageBodyWriterFoundFailure resteasy
    via Stack Overflow by Ramesh
    ,
  • jersey sse doesn&#39;t work on wildfly 8.2
    via by Unknown author,
    • org.jboss.resteasy.core.NoMessageBodyWriterFoundFailure: Could not find MessageBodyWriter for response object of type: java.lang.String of media type: application/json at org.jboss.resteasy.core.ServerResponse.writeTo(ServerResponse.java:216)[651:helloworld-org-jboss-resteasy:2.2.3.GA] at org.jboss.resteasy.core.SynchronousDispatcher.writeJaxrsResponse(SynchronousDispatcher.java:579)[651:helloworld-org-jboss-resteasy:2.2.3.GA] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:500)[651:helloworld-org-jboss-resteasy:2.2.3.GA] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)[651:helloworld-org-jboss-resteasy:2.2.3.GA] at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)[651:helloworld-org-jboss-resteasy:2.2.3.GA] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)[651:helloworld-org-jboss-resteasy:2.2.3.GA] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)[651:helloworld-org-jboss-resteasy:2.2.3.GA] at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)[111:org.apache.geronimo.specs.geronimo-servlet_2.5_spec:1.1.2] at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:538)[99:org.eclipse.jetty.servlet:7.4.5.v20110725] at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:478)[99:org.eclipse.jetty.servlet:7.4.5.v20110725] at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:70)[113:org.ops4j.pax.web.pax-web-jetty:1.0.7] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:480)[101:org.eclipse.jetty.security:7.4.5.v20110725] at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:937)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:116)[113:org.ops4j.pax.web.pax-web-jetty:1.0.7] at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)[99:org.eclipse.jetty.servlet:7.4.5.v20110725] at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:871)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:72)[113:org.ops4j.pax.web.pax-web-jetty:1.0.7] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.eclipse.jetty.server.Server.handle(Server.java:346)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:589)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1065)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:823)[102:org.eclipse.jetty.http:7.4.5.v20110725] at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:220)[102:org.eclipse.jetty.http:7.4.5.v20110725] at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411)[98:org.eclipse.jetty.server:7.4.5.v20110725] at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:535)[100:org.eclipse.jetty.io:7.4.5.v20110725] at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)[100:org.eclipse.jetty.io:7.4.5.v20110725] at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)[110:org.eclipse.jetty.util:7.4.5.v20110725] at java.lang.Thread.run(Thread.java:662)[:1.6.0_27]

    Users with the same issue

    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    12 more bugmates