title: Getting 404 error when trying to access swagger.json
body: <p>I tried to follow the documentation to integrate swagger into an existing API. This is the tutorial : <a href="https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-Jersey-1.X-Project-Setup-1.5" rel="nofollow noreferrer">https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-Jersey-1.X-Project-Setup-1.5</a></p>
  
  <p>I added the maven dependency in pom.xml -</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;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;jersey-server&lt;/artifactId&gt;
                  &lt;groupId&gt;com.sun.jersey&lt;/groupId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                 &lt;artifactId&gt;jersey-multipart&lt;/artifactId&gt;
                 &lt;groupId&gt;com.sun.jersey.contribs&lt;/groupId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>Not very sure if I should add the exclusion.
  Then for the package scanning, I added the following. The jersey servletContainer already was existing there. I just added initializing parameters to it.</p>
  
  <pre><code>&lt;servlet&gt;
  &lt;servlet-name&gt;JAX-RS Servlet&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;com.sun.jersey.config.property.packages&lt;/param-name&gt;
    &lt;param-value&gt;
      io.swagger.jaxrs.json;
      io.swagger.jaxrs.listing;
      jp.co.mycompany.rest.api.resource
    &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;JAX-RS Servlet&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/itemapi/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>Then I added the following servlet to web.xml, which is supposed to be the last step.</p>
  
  <pre><code>&lt;servlet&gt;
  &lt;servlet-name&gt;Jersey2Config&lt;/servlet-name&gt;
  &lt;servlet-class&gt;io.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;0.0.1-SNAPSHOT&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:7001//itemapi/&lt;/param-value&gt;
  &lt;/init-param&gt;
  &lt;load-on-startup&gt;2&lt;/load-on-startup&gt;
  </code></pre>
  
  <p></p>
  
  <p>My context root is "/". So now when I go to <a href="http://localhost:7001//itemapi/swagger.json" rel="nofollow noreferrer">http://localhost:7001//itemapi/swagger.json</a> i get a 404 error.</p>
  
  <p>For information this is a JAX-RS Jersey 1.9 REST API deploying on WebLogic. 
  I researched a little and some people said using custom application works instead of the package scanning servlet. I created the class below (maybe somethings wrong here):</p>
  
  <pre><code>package test;
  
  import java.util.HashSet;
  import java.util.Set;
  
  import javax.ws.rs.ApplicationPath;
  import javax.ws.rs.core.Application;
  
  @ApplicationPath("/itemapi")
  public class MyApplication extends Application {
  
      @Override
      public Set&lt;Class&lt;?&gt;&gt; getClasses() {
      Set&lt;Class&lt;?&gt;&gt; classes = new HashSet&lt;Class&lt;?&gt;&gt;();
  
      classes.add(jp.co.mycompany.api.resource.EventItemResource.class);
      classes.add(jp.co.mycompany.api.resource.EventItemResourceBase.class);
      classes.add(jp.co.mycompany.api.resource.EventItemResponseJsonMessageBodyWriter.class);     
      classes.add(jp.co.mycompany.api.resource.JsonMessageBodyWriter.class);
      classes.add(jp.co.mycompany.api.resource.JsonMessageBodyWriterBase.class);
      classes.add(jp.co.mycompany.api.resource.NormalItemResourceBase.class);
      classes.add(jp.co.mycompany.api.resource.NormalItemResourceCommon.class);
      classes.add(jp.co.mycompany.api.resource.NormalItemResultJsonMessageBodyWriter.class);
      classes.add(jp.co.mycompany.api.resource.ValidatingEventItemXmlRequest.class);
      classes.add(jp.co.mycompany.api.resource.ValidatingNormalItemXmlRequest.class);
      classes.add(jp.co.mycompany.api.resource.ValidatingXmlRequest.class);
      classes.add(io.swagger.jaxrs.listing.ApiListingResource.class);
      classes.add(io.swagger.jaxrs.listing.SwaggerSerializers.class);
  
      return classes;
      }
  }
  </code></pre>
  
  <p>The thing is I don't know how to make sure this class is being run. Do I have to add a snippet in web.xml. The class is saved in a separate package called 'test'. </p>
  
  <p>First of all why was I getting the 404 error? Did I miss something? Secondly if that is an issue how do I save and run this custom application class??</p>
  
  <p>Thanks in advance for all the help!</p>