RESTEasy client can't find JSON provider in an application deployed in JBoss EAP 6.x
Issue
- Having an application that contains a servlet that uses RESTEasy client and the Proxy class to create a client based on my JAX-RS interface:
When reaching it, seems that the JSON built in provider isn't found and the error below is thrown:
org.jboss.resteasy.client.exception.ResteasyClientException: Unexpected exception type
org.jboss.resteasy.client.exception.mapper.ApacheHttpClient4ExceptionMapper.toException(ApacheHttpClient4ExceptionMapper.java:73)
org.jboss.resteasy.client.exception.mapper.ApacheHttpClient4ExceptionMapper.toException(ApacheHttpClient4ExceptionMapper.java:59)
org.jboss.resteasy.client.core.ClientInvoker.invoke(ClientInvoker.java:118)
org.jboss.resteasy.client.core.ClientProxy.invoke(ClientProxy.java:88)
$Proxy113.test(Unknown Source)
com.abc.MyServlet.doGet(MyServlet.java:48)
javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
JBWEB000071: root cause
java.lang.RuntimeException: could not find writer for content-type application/json type: com.abc.MyJaxRsInterface
org.jboss.resteasy.client.ClientRequest.writeRequestBody(ClientRequest.java:469)
org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.writeRequestBodyToOutputStream(ApacheHttpClient4Executor.java:393)
org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.buildEntity(ApacheHttpClient4Executor.java:360)
org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.loadHttpMethod(ApacheHttpClient4Executor.java:332)
org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.execute(ApacheHttpClient4Executor.java:180)
org.jboss.resteasy.core.interception.ClientExecutionContextImpl.proceed(ClientExecutionContextImpl.java:39)
org.jboss.resteasy.plugins.interceptors.encoding.AcceptEncodingGZIPInterceptor.execute(AcceptEncodingGZIPInterceptor.java:40)
org.jboss.resteasy.core.interception.ClientExecutionContextImpl.proceed(ClientExecutionContextImpl.java:45)
org.jboss.resteasy.client.ClientRequest.execute(ClientRequest.java:443)
org.jboss.resteasy.client.ClientRequest.httpMethod(ClientRequest.java:677)
org.jboss.resteasy.client.core.ClientInvoker.invoke(ClientInvoker.java:111)
org.jboss.resteasy.client.core.ClientProxy.invoke(ClientProxy.java:88)
$Proxy113.test(Unknown Source)
com.abc.MyServlet.doGet(MyServlet.java:48)
javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
- But if accessing a JAX-RS application and then access the client, it will work. How to initialize RESTEasy built in JSON provider?
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
