facebook

Restful Webservice – application/xml mime issue – workbench7

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #294463 Reply

    onlinenanda
    Member

    – 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

    #294520 Reply

    Brian Fernandes
    Moderator

    You 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.

    #294522 Reply

    Loyal Water
    Member

    Moving to Off Topic >> Software Development.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Restful Webservice – application/xml mime issue – workbench7

You must be logged in to post in the forum log in