- This topic has 2 replies, 3 voices, and was last updated 15 years, 9 months ago by Loyal Water.
-
AuthorPosts
-
onlinenandaMember– Code –
import java.util.ArrayList;
import java.util.List;import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;import com.sun.jersey.spi.resource.Singleton;
@Produces(“application/xml”)
@Path(“processDefinitions”)
@Singleton
public class ProcessDefinitionResource {@GET
public List<ProcessDefinition> getProcessDefinitions() {
List<ProcessDefinition> ProcessDefinitions = new ArrayList<ProcessDefinition>();
ProcessDefinition definition = new ProcessDefinition();
definition.setId(“01”);
definition.setName(“Test Definition”);
ProcessDefinitions.add(definition);
return ProcessDefinitions;
}
}Exception
SEVERE: A message body writer for Java type, class java.util.ArrayList, and MIME media type, application/xml, was not found
javax.ws.rs.WebApplicationException
at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:239)
at com.sun.jersey.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:752)
at com.sun.jersey.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:692)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:344)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)Any Idea Anything Missing – workbench 7.0 issue
Brian FernandesModeratorYou need to provide Jersey with further information it needs to be able to serialize and deserialize your ProcessDefinitions list.
I would recommend reading this chapter for information: http://docs.sun.com/app/docs/doc/820-4867/ggnxo?l=en&a=view specifically look at the MessageBodyReader and MessageBodyWriter classes.
Hope this helps.
Loyal WaterMemberMoving to Off Topic >> Software Development.
-
AuthorPosts