title: JAX-RS Application in JBoss EAP 6.4 - JBWEB000260
body: <p>I'm converting an older web application from Tomcat to JBoss EAP 6.4. Its REST-services had been using Jersey which I'm removing because JBoss EAP 6.4 includes RESTeasy and the resources are using jax-rs annotations only. </p>
  
  <p>For each service I've added an application extends <code>java.ws.rs.core.Application</code>, e.g.:</p>
  
  <pre><code>package x.rest.external;
  
  import java.util.HashSet;
  import java.util.Set;
  
  import javax.ws.rs.core.Application;
  
  public class ExternalApplication extends Application {
  
      @Override
      public Set&lt;Class&lt;?&gt;&gt; getClasses() {
          Set&lt;Class&lt;?&gt;&gt; classes = new HashSet&lt;&gt;();
          classes.add(ResourceY.class);
          classes.add(ResourceZ.class);
          return classes;
      }
  }
  </code></pre>
  
  <p>I want to use no RESTeasy or JBoss specific method to declare this service:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="3.0" 
      xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"&gt;
  
      [...]
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;x.rest.external.ExternalApplication&lt;/servlet-name&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;x.rest.external.ExternalApplication&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/rest/external/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
      [...]
  
  &gt;
  </code></pre>
  
  <p>As far as I can tell from the specification and various web sources, this should suffice to get the service up and running. But if I'm calling the service all I get is:</p>
  
  <pre><code>10:54:51,630 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/x]] (ServerService Thread Pool -- 44) JBWEB000289: Servlet x.rest.external.ExternalApplication threw load() exception: javax.servlet.ServletException: JBWEB000260: No servlet class has been specified for servlet x.rest.external.ExternalApplication
  </code></pre>
  
  <p>I know there are ways to use some RESTeasy servlet or use annotation only configurations. I want the application to stay as container independent as possible and think base paths should all be declared in the <code>web.xml</code> descriptor.</p>
  
  <p><strong>EDIT</strong>: seems to boil down to <a href="https://issues.jboss.org/browse/RESTEASY-650" rel="nofollow">RESTEASY-650</a> and <a href="https://issues.jboss.org/browse/RESTEASY-738" rel="nofollow">RESTEASY-738</a> which are fixed in RESTeasy 3.x but JBoss EAP 6.4 ships with 2.3.x. </p>
  
  <p>To avoid the <code>org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011232: Only one JAX-RS Application Class allowed</code> exception I've to disable all resteasy scan in 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>which in turn let JBoss choking on unspecified servlets: <code>javax.servlet.ServletException: JBWEB000260: No servlet class has been specified</code>. </p>
  
  <p>If I disable all but one JAX-RS applications both using <code>@ApplicationPath</code> and <code>web.xml</code> declarations work.</p>
  
  <p><strong>EDIT 2:</strong> runs fine in JBoss EAP 7.0 beta.</p>