Reputation: 1352
I am getting the below error even though the RESTEasy JAXB jar - resteasy-jaxb-provider.jar is bundled in the WAR file
04:52:54,461 ERROR [org.jboss.resteasy.core.SynchronousDispatcher] (default task-1) Failed executing GET /editor/getMetadata/com.karthik.editor.model.EditorAuditEditor: o
rg.jboss.resteasy.core.NoMessageBodyWriterFoundFailure: Could not find MessageBodyWriter for response object of type: com.karthik.SerializedStatusTO of media type: app
lication/xml
at org.jboss.resteasy.core.ServerResponse.writeTo(ServerResponse.java:166)
at org.jboss.resteasy.core.SynchronousDispatcher.writeJaxrsResponse(SynchronousDispatcher.java:485)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:422)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:111)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:217)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:159)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
I have also included jboss-deployment-structure.xml in my WAR to exclude JBoss provided module/jars
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<exclude-subsystems>
<subsystem name="resteasy" />
</exclude-subsystems>
<exclusions>
<module name="javaee.api" />
<module name="javax.ws.rs.api"/>
<module name="org.jboss.resteasy.resteasy-jaxrs" />
</exclusions>
<local-last value="true" />
</deployment>
</jboss-deployment-structure>
I have deployed the WAR on JBoss 7 EAP. I am currently working on migrating my apps from JBoss 5 to JBoss 7. There is no code change and works fine on JBoss5. Can you please help resolve this issue on JBOSS 7.
Upvotes: 3
Views: 1596
Reputation: 1352
Finally, I found the solution.
The issue was the subsystem name. There is no subsystem named “resteasy”, the subsystem is actually named “jaxrs”.
I updated the subsystem name in the jboss-deployment-structure.xml as shown below :
<exclude-subsystems>
<subsystem name="jaxrs" />
</exclude-subsystems>
Upvotes: 2
Reputation: 565
Essentially, you've told your server to send a SerializedStatusTO object back to the client as a response but it doesnt know how to turn that into a string. You need to include a jar that has a MessageBodyWriter for the com.karthik.SerializedStatusTO class or, if this is a class you have made, you need to make and include one yourself.
https://jersey.java.net/documentation/latest/message-body-workers.html#d0e6952
IIRC if your bean is JAXB annotated it shouldn't need a custom writer though. Could you provide the code for the bean and the method that sends the server response?
Upvotes: 0