I'm developing an application on EAP 6.3. I need to invoke a rest service so I used pice of code like this:
ClientRequest request = new ClientRequest(URL);
...
request.body(MediaType.APPLICATION_JSON, input);
...
ClientResponse<String> response = request.post(String.class);
...
In my pom imported this bom:
<dependency>
<groupId>org.jboss.bom.eap</groupId>
<artifactId>jboss-javaee-6.0-with-resteasy</artifactId>
<version>6.3.0.GA</version>
<type>pom</type>
<scope>import</scope>
</dependency>
And than I defined the dependency with scope provided:
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<scope>provided</scope>
</dependency>
Unfortunatelly, running the previous code I get this error:
...
Caused by: java.lang.ClassNotFoundException: org.jboss.resteasy.client.ClientRequest from [Module "deployment.ats-ear.ear.ats-web.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final-redhat-1]
... 87 more
Looking on the server in modules\system\layers\base\org\jboss\resteasy\resteasy-jaxrs\main actually there is the jar resteasy-jaxrs-2.3.8.Final-redhat-3.jar that contains the class: org.jboss.resteasy.client.ClientRequest
I don't get what I'm doing wrong... mayde I need to specify something in the in jbooss-deployment-structure.xml?
If I set the scope of resteasy-jaxrs as compile, everthing works fine, but I don't think is a good idea to put in my ear a library already present on the server.