Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

getting exception while accessing REST API  RSS feed

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(
at org.restlet.ext.jaxrs.internal.provider.AbstractJaxbProvider.marshal(
at org.restlet.ext.jaxrs.internal.provider.JaxbProvider.writeTo(
at org.restlet.ext.jaxrs.internal.wrappers.provider.SingletonProvider.writeTo(
at org.restlet.ext.jaxrs.internal.util.JaxRsOutputRepresentation.write(
at com.noelios.restlet.http.HttpServerCall.writeResponseBody(
at com.noelios.restlet.http.HttpServerCall.sendResponse(
at com.noelios.restlet.http.HttpServerConverter.commit(
at com.noelios.restlet.http.HttpServerHelper.handle(
at com.noelios.restlet.http.StreamServerHelper$
at java.util.concurrent.Executors$ Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$ Source)
at 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
Boost this thread!