| Author |
Message |
|
|
Post subject: REST service tutorial results in MIME not found error
Posted: Jun 21, 2012 - 01:40 AM
|
|
Registered Member

Joined: Nov 12, 2008
Posts: 63
|
|
I am trying to use the tutorial for creating a REST service in ME 8.6 and when I run the service and try to test it from the REST Web Services Explorer it always produces the following error:
Jun 20, 2012 5:30:26 PM com.sun.jersey.spi.container.ContainerResponse write
SEVERE: A message body writer for Java type, class com.myeclipseide.ws.Customer, and MIME media type, application/xml, was not found
Jun 20, 2012 5:30:26 PM com.sun.jersey.server.impl.application.WebApplicationImpl onException
SEVERE: Internal server error
javax.ws.rs.WebApplicationException
at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:241)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:724)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:647)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:638)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:309)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:425)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:590)
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(Thread.java:619)
I have deleted and recreated the project multiple times, verifying that everything is the same as the tutorial entries and have not been able to get past this error.
Can anyone shed some light on what might be wrong?
Thanks |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jun 21, 2012 - 10:41 AM
|
|

Joined: Nov 11, 2010
Posts: 2151
|
|
|
_________________ Swapna
MyEclipse Support
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jun 21, 2012 - 12:51 PM
|
|
Registered Member

Joined: Nov 12, 2008
Posts: 63
|
|
I knew I had to be missing something and that was it.
Thanks much |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jun 21, 2012 - 01:13 PM
|
|
Registered Member

Joined: Nov 12, 2008
Posts: 63
|
|
Another related question, where can I find info on setting up JSON REST services?
Cause when I try to change the produces to application/json I get the same type of error and could not find any examples of what to change to produce or consume json rather than xml.
Thanks for any pointers. |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jun 22, 2012 - 05:44 AM
|
|

Joined: Nov 11, 2010
Posts: 2151
|
|
mongonv,
Glad that the issue is resolved.
Regarding setting up JSON, our tutorials will only give you an initial start with the MyEclipse. You will have to check the related development forums for development specific questions.
I suggest you cross post to webservices forums for this issue.
Hope it helps. |
_________________ Swapna
MyEclipse Support
|
| |
|
|
|
 |
|
|
Post subject: REST returning JSON in Myeclipse Not working
Posted: Sep 26, 2012 - 03:21 PM
|
|
Registered Member

Joined: Aug 18, 2012
Posts: 3
|
|
K.
I've tried all the demo's and everything else. I'm still getting the same error.
SEVERE: A message body writer for Java type, class java.util.ArrayList, and MIME media type, application/json, was not found
| Code: |
@Produces("application/json")
@XmlRootElement
public class Nastytask {
private String name;
private int id;
public String getName(){
return name;
}
public int getId(){ return id;}
public void setId(int id) { this.id=id; }
public void setName(String name) { this.name = name; }
}
//In my resource class
List<Nastytask> nastytasks=new ArrayList<Nastytask>();
@GET
@Produces("application/json")
public List<Nastytask> getNastytasks() throws Exception{
Nastytask ni=new Nastytask();
ni.setName("Item 1");
nastytasks.add(ni);
ni=new Nastytask();
ni.setName("Item 2");
nastytasks.add(ni);
return nastytasks;
}
|
|
|
|
| |
|
|
|
 |
|
|
Post subject: Followup to prior post
Posted: Sep 26, 2012 - 03:23 PM
|
|
Registered Member

Joined: Aug 18, 2012
Posts: 3
|
|
application/xml works just fine. |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Sep 27, 2012 - 05:53 AM
|
|

Joined: Nov 11, 2010
Posts: 2151
|
|
srmcatee,
Glad that you got it working.
Do let us know if you have any issues. |
_________________ Swapna
MyEclipse Support
|
| |
|
|
|
 |
|
|
Post subject: Didn't fix it.
Posted: Oct 01, 2012 - 08:14 PM
|
|
Registered Member

Joined: Aug 18, 2012
Posts: 3
|
|
application/xml works.
I'm trying to get application/json to work. |
|
|
| |
|
|
|
 |
|
|
Post subject: JSON vs XML
Posted: Feb 11, 2013 - 02:05 PM
|
|
Registered Member

Joined: Jun 18, 2012
Posts: 5
|
|
I too noticed that XML is the flavor of choice in your tutorial.
XML appears from what I have been reading is being superceded with JSON among the industry. At lest you could have done was addressed his question , either answer you don't know or "here is a hint on how you would go about returning JSON" or even a link.
quote="support-swapna"]mongonv,
Glad that the issue is resolved.
Regarding setting up JSON, our tutorials will only give you an initial start with the MyEclipse. You will have to check the related development forums for development specific questions.
I suggest you cross post to webservices forums for this issue.
Hope it helps.[/quote] |
|
|
| |
|
|
|
 |
|
|