title: Jersey 2 on Jboss 7
body: <p>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:</p>
  
  <pre><code>"java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;"
  </code></pre>
  
  <p>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:</p>
  
  <p>1) Added the following to my web.xml:</p>
  
  <pre><code>&lt;context-param&gt;
      &lt;param-name&gt;resteasy.scan&lt;/param-name&gt;
      &lt;param-value&gt;false&lt;/param-value&gt;
  &lt;/context-param&gt;
  &lt;context-param&gt;
      &lt;param-name&gt;resteasy.scan.providers&lt;/param-name&gt;
      &lt;param-value&gt;false&lt;/param-value&gt;
  &lt;/context-param&gt;
  &lt;context-param&gt;
      &lt;param-name&gt;resteasy.scan.resources&lt;/param-name&gt;
      &lt;param-value&gt;false&lt;/param-value&gt;
  &lt;/context-param&gt;
  </code></pre>
  
  <p>2) Followed the discussion <a href="https://stackoverflow.com/questions/19225618/java-restfull-webservice-jax-rs-implementation-with-jersey-2-3-1-libraries">here</a>, I modified my JBoss' standalone.xml, module.xml, and domain.xml to remove all references to JAXRS1.1 / RestEasy.</p>
  
  <p>3) This led to another error: "java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor" which I resolved by adding the following to my pom.xml:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;asm&lt;/groupId&gt;
      &lt;artifactId&gt;asm&lt;/artifactId&gt;
      &lt;version&gt;3.3.1&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>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.</p>
  
  <p>Additionally I've also tried creating a jboss-deployment-structure.xml file, but then I still encounter the previous errors like "java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;"</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;  
  &lt;jboss-deployment-structure&gt;
    &lt;deployment&gt;
      &lt;exclusions&gt;
              &lt;module name="org.jboss.resteasy.resteasy-atom-provider"/&gt;  
              &lt;module name="org.jboss.resteasy.resteasy-cdi"/&gt;  
              &lt;module name="org.jboss.resteasy.resteasy-jackson-provider"/&gt;  
              &lt;module name="org.jboss.resteasy.resteasy-jaxb-provider"/&gt;  
              &lt;module name="org.jboss.resteasy.resteasy-jaxrs"/&gt;  
              &lt;module name="org.jboss.resteasy.resteasy-jettison-provider"/&gt;  
              &lt;module name="org.jboss.resteasy.resteasy-jsapi"/&gt;  
              &lt;module name="org.jboss.resteasy.resteasy-multipart-provider"/&gt;  
              &lt;module name="org.jboss.resteasy.resteasy-yaml-provider"/&gt;  
              &lt;module name="org.apache.log4j"/&gt;  
              &lt;module name="org.apache.commons.pool"/&gt;  
              &lt;module name="javax.ws.rs.api"/&gt;
      &lt;/exclusions&gt;
    &lt;/deployment&gt;
  &lt;/jboss-deployment-structure&gt;
  </code></pre>
  
  <p>Has anyone had any luck with Jboss and Jersey 2.x? Any help would be appreciated.</p>