• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting exception while accessing REST API

Rajit Patel
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
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
Posts: 2198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic