Impossible to ignore module javax.ws.rs.api <=> use other than bundled RestEasy?!

Latest response

Hello,

We are using JBoss EAP 6.1.0, which is bundled with Rest Easy 2.3.6. We wanted to use the latest Rest Easy 3.0.6.Final for one of the webapps, without having to upgrade all the other webapps, i.e. without upgrading the resteasy modules. However, this seems to be impossible, is that correct?

The problem is that Rest Easy 3.0.6.Final requires a version of javax.ws.rs.core.Response with the method getHeaders, which is contained in jaxrs-api but is shadowed by Response from the javax.ws.rs.api module (jboss-jaxrs-api_1.1_spec-1.0.1.Final-redhat-2.jar). I added the module to exclusions in jboss-deployment-structure.xml but it had no effect. Is it correct that Java EE APIs cannot be excluded?

See a more detailed description of the problems at http://theholyjava.wordpress.com/2014/02/04/jboss-modules-suck-its-impossible-to-use-custom-resteasyjax-rs-under-jboss-7/

Summary: I'd like answers to two questions:

  1. Is it possible to use Rest Easy 3.0.6 for a webapp running at JBoss EAP 6.1 without upgrading or changing the modules, i.e. touching only the configuration of this app alone?
  2. Is it possible to exclude the javax.ws.rs.api module so that its classes do not pollute the classpath of my webapp?

Thank you!

Responses

I've got a tip from Billburke:

I’ve lived through your pain and here’s a solution that works on AS7.1.1, EAP6.x (not needed on Wildfly as it should be fixed there):
https://github.com/keycloak/keycloak/blob/master/server/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
JBoss Modules don’t suck. The implicit dependencies do. The culprit is the “javaee.api” module which you have missing from your exclude. This module includes every single Java EE API. I haven’t tried, but I think if you reduce your excludes to just that module and the “resteasy” subsystem, it will work.

Hi Lars. Did that advice resolve the issue for you?

I had a similar issue (trying to use CXF 3.0) and indeed exluding javaee.api does the trick with the caveat that I also had to add include all the modules that were included by javaee.api but the java.ws.rs.api.
(Note: I could not have added all of them but it was simpler that to try to find out which ones I really needed).

The other 'dirty' trick was simply to remove java.ws.rs.api from javaee.api assuming that not other apps needed it.

Thanks, Tinku