I want Jersey to work without changing Jboss Configurations

Posted on

My application is developed based on Jersey 2.0 which basically exposes and consumes REST Web Service. Currently it is running in Weblogic and we need to migrate to Jboss. As part of the migration steps , I have created jboss-deployment-structure.xml to instruct Jboss to exclude its in-build modules, instead load the jar from the APP-INF/lib folder. I have attached a copy of jboss-deployment-structure.xml and web.xml for your reference.
The problem is that just by doing changes to my EAR, Jboss couldn't able to deploy my EAR. Jboss was throwing "No Such Method Error" which is caused because Jboss internally used RESTEasy which in turn uses Jaxrs version 1.0. But the Jersey version used by my application uses jaxrs version 2.0.

After much struggle , I found two ways to solve this problem

First way, go to modules/../.../javax/ws/rs/api/main folder and replace the jaxrs v 1.0 to 2.0 and edit the module.xml to use v 2.0.

Second way, go to modules/../../javaee/api/main/ folder and remove '' from the module.xml file. I cannot exclude javaee in the jboss-deployment-structure, because my application uses Servlet from Jboss and If I exclude javaee , the servlet will also be not loaded.

Now My question

(a) Is there any way I can avoid changing the Jboss configuration under the modules folder to make my ear deploy and running successfully.

(b) If no, which one of the above mentioned ways are better. I personally prefer the second way.

(c) If option (a) and option (b) is not the right approach, what is the right approach to follow.

Attachments