title: Swagger JAX-RS with Jersey 1.19 gives 'Conflicting URI templates' error
body: <p>I am trying to add Swagger to an existing application that uses Jersey 1.19. For adding Swagger to the application, I have been following this guide: <a href="https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-Jersey-1.X-Project-Setup-1.5" rel="nofollow">https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-Jersey-1.X-Project-Setup-1.5</a>.</p>
  
  <p>When I deploy the application on Apache Tomcat, I get the following error: </p>
  
  <pre><code>SEVERE: Conflicting URI templates. The URI template / for root resource class io.swagger.jaxrs.listing.ApiListingResource and the URI template / transform to the same regular expression (/.*)?
  </code></pre>
  
  <p>The odd thing is that my Jersey servlet is not deployed at the root context, but at the /api/* context as shown in the web.xml file:</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;MyApp Service&lt;/servlet-name&gt;
      &lt;servlet-class&gt;com.sun.jersey.spi.container.servlet.ServletContainer&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;javax.ws.rs.Application&lt;/param-name&gt;
          &lt;param-value&gt;app.MyApplication&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;MyApp Service&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/api/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>My MyApplication class is defined below:</p>
  
  <pre><code>public class MyApplication extends Application {
  
  private final Set&lt;Object&gt; singletons = new HashSet&lt;Object&gt;();
  private final Set&lt;Class&lt;?&gt;&gt; classes = new HashSet&lt;Class&lt;?&gt;&gt;();
  
  public MyApplication() {
  
      MyResource resource= new MyResource();
  
      singletons.addAll(Arrays.asList(resource));
  
      BeanConfig beanConfig = new BeanConfig();
      beanConfig.setBasePath("/api");
      beanConfig.setResourcePackage(getClass().getPackage().getName());
      beanConfig.setTitle("REST API");
      beanConfig.setVersion("1.0.0");
      beanConfig.setScan(true);
  
      classes.add(io.swagger.jaxrs.listing.ApiListingResource.class);
      classes.add(io.swagger.jaxrs.listing.SwaggerSerializers.class);
  }
  
  @Override
  public Set&lt;Class&lt;?&gt;&gt; getClasses() {
      return classes;
  }
  
  @Override
  public Set&lt;Object&gt; getSingletons() {
      return singletons;
  }}
  </code></pre>
  
  <p>I have tried other configurations, such as defining the Swagger servlet in the web.xml file instead of using the BeanConfig, but the same error still occurs. I have gotten Swagger to work this way on a different project that uses Jersey 2, but unfortunately the current project has to remain on Jersey 1.19. Here is the Swagger dependency defined in the pom.xml file:</p>
  
  <pre><code>&lt;dependency&gt;
    &lt;groupId&gt;io.swagger&lt;/groupId&gt;
    &lt;artifactId&gt;swagger-jersey-jaxrs&lt;/artifactId&gt;
    &lt;version&gt;1.5.0&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>Any help would be appreciated.</p>