title: Adding swagger to a RestEasy servlet under JBoss - missing dependency and conflicting URI template
body: <p>I have been struggling with converting my servlet working under RestEasy and JBoss to include a Swagger description.  I have tried making some dependencies of scope provided, tried making them of type pom, tried changing the context-param's in the web.xml, etc. I have considered [this post ][1] and [this post] (which seemed a great match) [2] but seem to be going backwards so please help me address:</p>
  <pre><code>  SEVERE: Missing dependency for constructor public org.jboss.resteasy.plugins.providers.JaxrsServerFormUrlEncodedProvider(boolean) at parameter index 0
    SEVERE: Missing dependency for constructor public org.jboss.resteasy.core.AsynchronousDispatcher(org.jboss.resteasy.spi.ResteasyProviderFactory) at parameter index 0
    SEVERE: Conflicting URI templates. The URI template /api-docs for root resource class com.wordnik.swagger.jaxrs.listing.ApiListingResourceJSON and the URI template /api-docs transform to the same regular expression /api\-docs(/.*)?
  </code></pre>
  <p>The relevant part of my pom.xml seems to be (with irrelevant dependencies removed):</p>
  <pre><code>    &lt;properties&gt;
  ...     &lt;jackson.version&gt;2.10.0&lt;/jackson.version&gt;           
          &lt;version.org.slf4j&gt;1.7.26&lt;/version.org.slf4j&gt;
          &lt;swagger-version&gt;1.3.0&lt;/swagger-version&gt;        
          &lt;jax-rs-version&gt;1.1.1&lt;/jax-rs-version&gt;
          &lt;json4s-jackson-version&gt;3.2.4&lt;/json4s-jackson-version&gt;
          &lt;json4s-core-version&gt;3.0.0&lt;/json4s-core-version&gt;
          &lt;fasterxml-json-version&gt;2.2.2&lt;/fasterxml-json-version&gt;
          &lt;reflections-version&gt;0.9.9-RC1&lt;/reflections-version&gt;
          &lt;javassist-version&gt;3.16.1-GA&lt;/javassist-version&gt;
          &lt;paranamer-version&gt;2.5.2&lt;/paranamer-version&gt;
          &lt;scannotation-version&gt;1.0.3&lt;/scannotation-version&gt;
          &lt;servlet-api-version&gt;2.5&lt;/servlet-api-version&gt;
      &lt;/properties&gt;
  ...
          &lt;dependency&gt;
              &lt;groupId&gt;com.wordnik&lt;/groupId&gt;
              &lt;artifactId&gt;swagger-jaxrs_2.10&lt;/artifactId&gt;
              &lt;version&gt;1.3.5&lt;/version&gt;
          &lt;/dependency&gt;       
          &lt;dependency&gt;
              &lt;groupId&gt;javax&lt;/groupId&gt;
              &lt;artifactId&gt;javaee-web-api&lt;/artifactId&gt;
              &lt;version&gt;6.0&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.thetransactioncompany&lt;/groupId&gt;
              &lt;artifactId&gt;cors-filter&lt;/artifactId&gt;
              &lt;version&gt;1.5.1&lt;/version&gt;
          &lt;/dependency&gt;
         &lt;dependency&gt;
              &lt;groupId&gt;com.wordnik&lt;/groupId&gt;
              &lt;artifactId&gt;swagger-servlet_2.10&lt;/artifactId&gt;
              &lt;version&gt;1.3.0&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;artifactId&gt;dom4j&lt;/artifactId&gt;
                      &lt;groupId&gt;dom4j&lt;/groupId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
              &lt;type&gt;jar&lt;/type&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-jaxrs&lt;/artifactId&gt;
              &lt;version&gt;1.9.13&lt;/version&gt; 
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.ws.rs&lt;/groupId&gt;
              &lt;artifactId&gt;jsr311-api&lt;/artifactId&gt;
              &lt;version&gt;${jax-rs-version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.json4s&lt;/groupId&gt;
              &lt;artifactId&gt;json4s-jackson_2.9.1-1&lt;/artifactId&gt;
              &lt;version&gt;${json4s-jackson-version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.json4s&lt;/groupId&gt;
              &lt;artifactId&gt;json4s-core_2.9.2&lt;/artifactId&gt;
              &lt;version&gt;${json4s-core-version}&lt;/version&gt;
          &lt;/dependency&gt;        
          &lt;dependency&gt;
              &lt;groupId&gt;com.thoughtworks.paranamer&lt;/groupId&gt;
              &lt;artifactId&gt;paranamer&lt;/artifactId&gt;
              &lt;version&gt;${paranamer-version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.scala-lang&lt;/groupId&gt;
              &lt;artifactId&gt;scala-library&lt;/artifactId&gt;
              &lt;version&gt;2.12.15&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.reflections&lt;/groupId&gt;
              &lt;artifactId&gt;reflections&lt;/artifactId&gt;
              &lt;version&gt;${reflections-version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
              &lt;version&gt;${servlet-api-version}&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.javassist&lt;/groupId&gt;
              &lt;artifactId&gt;javassist&lt;/artifactId&gt;
              &lt;version&gt;${javassist-version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.scannotation&lt;/groupId&gt;
              &lt;artifactId&gt;scannotation&lt;/artifactId&gt;
              &lt;version&gt;${scannotation-version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.wordnik&lt;/groupId&gt;
              &lt;artifactId&gt;swagger-jersey-jaxrs_2.9.1&lt;/artifactId&gt;
              &lt;version&gt;${swagger-version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.wordnik&lt;/groupId&gt;
              &lt;artifactId&gt;swagger-annotations_2.9.1&lt;/artifactId&gt;
              &lt;version&gt;${swagger-version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.wordnik&lt;/groupId&gt;
              &lt;artifactId&gt;swagger-core_2.9.1&lt;/artifactId&gt;
              &lt;version&gt;${swagger-version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.wordnik&lt;/groupId&gt;
              &lt;artifactId&gt;swagger-jaxrs_2.9.1&lt;/artifactId&gt;
              &lt;version&gt;${swagger-version}&lt;/version&gt;
          &lt;/dependency&gt;   
        &lt;dependency&gt;
                  &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
                  &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
                  &lt;version&gt;${jackson.version}&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
              &lt;version&gt;${jackson.version}&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
              &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
              &lt;artifactId&gt;httpclient&lt;/artifactId&gt;
              &lt;version&gt;4.5.13&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.jboss.resteasy&lt;/groupId&gt;
            &lt;artifactId&gt;resteasy-jaxrs-all&lt;/artifactId&gt;
            &lt;version&gt;2.2.1.GA&lt;/version&gt;
            &lt;type&gt;pom&lt;/type&gt;                             
            &lt;scope&gt;provided&lt;/scope&gt;
       &lt;/dependency&gt;
  ...
  </code></pre>
  <p>The application is trivial:</p>
  <pre><code>    @Path(&quot;pam&quot;)
      @Provider
      @Api(value=&quot;/pam&quot;, description = &quot;Returns data&quot;)
      public class PamQueryHandler extends Application {
       
      public PamQueryHandler() {
      }
          
      @ApiOperation(value = &quot;Perform the actual query.&quot;, response = Response.class)    
      @GET
      @Path(&quot;/query&quot;)  
      @Produces(MediaType.APPLICATION_JSON)
      public Response handleQuery(@ApiParam(value=&quot;messageType&quot;) @QueryParam(&quot;messageType&quot;) String message) 
      {
  ...
      }
  </code></pre>
  <p>And a web.xml whose content is almost entirely to accommodate the Swagger description:</p>
  <pre><code>&lt;web-app&gt;
    &lt;display-name&gt;RESTful Querying of DBs&lt;/display-name&gt;
    
    &lt;context-param&gt;
         &lt;param-name&gt;resteasy.wider.request.matching&lt;/param-name&gt;
         &lt;param-value&gt;true&lt;/param-value&gt;
      &lt;/context-param&gt;
      
      &lt;context-param&gt;
          &lt;param-name&gt;javax.ws.rs.core.Application&lt;/param-name&gt;
          &lt;param-value&gt;com.goprecise.jbpm.rest.PamQueryHandler&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;resteasy.resources&lt;/param-name&gt;
          &lt;param-value&gt;com.wordnik.swagger.jaxrs.listing.ApiListingResourceJSON&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;resteasy.providers&lt;/param-name&gt;
          &lt;param-value&gt;
              com.wordnik.swagger.jaxrs.json.JacksonJsonProvider,
              com.wordnik.swagger.jaxrs.listing.ApiDeclarationProvider,
              com.wordnik.swagger.jaxrs.listing.ResourceListingProvider
          &lt;/param-value&gt;
      &lt;/context-param&gt;    
          
      &lt;listener&gt;
          &lt;listener-class&gt;org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap&lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;resteasy-servlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher&lt;/servlet-class&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;resteasy-servlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/query/*&lt;/url-pattern&gt;
          &lt;!--url-pattern&gt;/api-docs/*&lt;/url-pattern--&gt;
      &lt;/servlet-mapping&gt;
          
      &lt;servlet&gt;
          &lt;servlet-name&gt;DefaultJaxrsConfig&lt;/servlet-name&gt;
          &lt;servlet-class&gt;com.wordnik.swagger.jaxrs.config.DefaultJaxrsConfig&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;api.version&lt;/param-name&gt;
              &lt;param-value&gt;1.0.0&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;swagger.api.basepath&lt;/param-name&gt;
              &lt;param-value&gt;http://localhost:8090/PamQuery&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;load-on-startup&gt;2&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  &lt;/web-app&gt;
  
    [1]: https://stackoverflow.com/questions/8171342/why-wont-jboss-resteasy-maven-dependency-work
    [2]: https://stackoverflow.com/questions/9378106/jboss-7-1-0-error-unable-to-find-a-public-constructor-for-class-org-jboss-rest
  </code></pre>