File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes getting exception while accessing REST API Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "getting exception while accessing REST API" Watch "getting exception while accessing REST API" New topic
Author

getting exception while accessing REST API

Rajit Patel
Greenhorn

Joined: Aug 01, 2008
Posts: 9
Hi All..

I am writting a REST based webservices using REST Easy API. Webservice is giving result in either application/xml or application/json as per accept Header. When my result is application/xml, i am gettting a below exception on console..

SEVERE: An exception occured writing the response entity
javax.ws.rs.WebApplicationException
at org.restlet.ext.jaxrs.internal.provider.AbstractJaxbProvider.getJaxbContext(AbstractJaxbProvider.java:65)
at org.restlet.ext.jaxrs.internal.provider.AbstractJaxbProvider.marshal(AbstractJaxbProvider.java:84)
at org.restlet.ext.jaxrs.internal.provider.JaxbProvider.writeTo(JaxbProvider.java:106)
at org.restlet.ext.jaxrs.internal.wrappers.provider.SingletonProvider.writeTo(SingletonProvider.java:335)
at org.restlet.ext.jaxrs.internal.util.JaxRsOutputRepresentation.write(JaxRsOutputRepresentation.java:105)
at com.noelios.restlet.http.HttpServerCall.writeResponseBody(HttpServerCall.java:492)
at com.noelios.restlet.http.HttpServerCall.sendResponse(HttpServerCall.java:428)
at com.noelios.restlet.http.HttpServerConverter.commit(HttpServerConverter.java:391)
at com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHelper.java:148)
at com.noelios.restlet.http.StreamServerHelper$ConnectionHandler.run(StreamServerHelper.java:86)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

One more thing, I am using Jaxb to convert object to xml..

Please anybody can help me???
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Just curious: Are you really using RESTEasy? It looks like you are using RESTlets from the stacktrace. It could be that RESTEasy uses RESTlets internally.
Anyway, it looks like your problem is related to JAXB not being able to obtain a context. Do you have unit tests that tests marshalling of Java objects to XML? If not, I would recommend writing at least one to make sure things work as they should without having to run the service.
Best wishes!
 
wood burning stoves
 
subject: getting exception while accessing REST API
 
Similar Threads
Run JAR file in Applet
unable to resources in JNLP
New To JSP
Exception
Unable to launch application under Tomcat 6.0