2 Replies Latest reply on Sep 22, 2015 4:25 PM by iominh

    Jersey 2 and Jboss 7

    iominh

      Has anyone had success deploying Jersey 2.x with JBoss 7.x? I've tried deploying Jersey 2.5 with JBoss 7.1.1 but encountered errors like:

       

      "java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;"

       

      I believe this issue is because JBoss comes bundled with RestEasy which is a JAX-RS 1.0 implementation while Jersey is a JAX-RS 2.0 implementation. So I took the following steps to disable RestEasy:

       

      1) Adding the following to my web.xml:

         

          <context-param>

              <param-name>resteasy.scan</param-name>

              <param-value>false</param-value>

          </context-param>

          <context-param>

              <param-name>resteasy.scan.providers</param-name>

              <param-value>false</param-value>

          </context-param>

          <context-param>

              <param-name>resteasy.scan.resources</param-name>

              <param-value>false</param-value>

          </context-param>

       

      2) Following the discussion here, I modified my JBoss' standalone.xml, module.xml, and domain.xml to remove all references to JAXRS1.1 / RestEasy.

       

      3) This led to another error: "java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor" which I resolved by adding the following to my pom.xml:

       

        <dependency>

              <groupId>asm</groupId>

              <artifactId>asm</artifactId>

              <version>3.3.1</version>

          </dependency>

       

      So finally my app deploys without errors but now I cannot seem to access any of my Jersey resources. Jetty 8 works fine, however. I also was able to run Jersey 1.x without having to take steps #2 and #3 but I would prefer to use Jersey 2.x if possible.


      Additionally I've also tried creating a jboss-deployment-structure.xml file, but then I encounter the previous errors like "java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;"


      <?xml version="1.0" encoding="UTF-8"?> 

      <jboss-deployment-structure>

        <deployment>

         <exclusions>

         <module name="org.jboss.resteasy.resteasy-jaxrs"/> 

         <module name="javax.ws.rs.api"/>

         </exclusions>

        </deployment>

      </jboss-deployment-structure>

       

      Has anyone had any luck with Jboss and Jersey 2.x? Any help or guidance would be appreciated.