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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Web Services
Reply 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
Bartender

Joined: Oct 04, 2006
Posts: 2193
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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getting exception while accessing REST API
 
Similar Threads
unable to resources in JNLP
Unable to launch application under Tomcat 6.0
Run JAR file in Applet
Exception
New To JSP