title: Swagger configuration - 404 when accessing swagger.json
body: <p>I'm new to swagger and looking to get it set up on my latest REST API project but am failing miserably. Everything seems to be configured correctly but I am unable to navigate to swagger.json without getting a 404. I can't see what is missing or wrong</p>
  
  <p>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;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.sun.jersey.contribs&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-multipart&lt;/artifactId&gt;
          &lt;version&gt;1.11.1&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.sun.jersey&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-server&lt;/artifactId&gt;
          &lt;version&gt;1.11.1&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>Exclusions as the project uses version 1.11.1 and causes conflicts if 1.13 is imported from swagger</p>
  
  <p>web.xml</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;Jersey REST 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;com.sun.jersey.config.property.packages&lt;/param-name&gt;
          &lt;param-value&gt;
              io.swagger.jaxrs.json,
              io.swagger.jaxrs.listing,
              uk.package.test.myproject
          &lt;/param-value&gt;
      &lt;/init-param&gt;       
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &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;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:8082/myproject/api&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;2&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Jersey REST Service&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/api/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>Example annotations...</p>
  
  <pre><code>@ManagedBean
  @Path("secure/cache")
  @Restrict("ManageCache")
  @Api(value = "secure/cache", description = "Rest api for do operations on     admin", produces = MediaType.APPLICATION_JSON)
  public class AdminApi {....
  
  
  @GET
  @Path("{name}")
  @Produces(MediaType.APPLICATION_JSON)
  
  @ApiOperation(value = "Get specific admin", httpMethod = "GET", notes = "Fetch the admin user details", response = Response.class)
  @ApiResponses(value = { @ApiResponse(code = 200, message = "Given admin user found"),
      @ApiResponse(code = 404, message = "Given admin user not found"),
      @ApiResponse(code = 500, message = "Internal server error due to encoding the data"),
      @ApiResponse(code = 400, message = "Bad request due to decoding the data"),
      @ApiResponse(code = 412, message = "Pre condition failed due to required data not found") })
  
  public List&lt;String&gt; getCacheKeys(.....
  </code></pre>
  
  <p>When the project is run the following is logged...</p>
  
  <pre><code>10:46:48,724 INFO  [com.sun.jersey.api.core.PackagesResourceConfig] (MSC service thread 1-5) Scanning for root resource and provider classes in the packages:
    io.swagger.jaxrs.json
    io.swagger.jaxrs.listing
    uk.package.test.myproject
  10:46:48,771 INFO  [com.sun.jersey.api.core.ScanningResourceConfig] (MSC service thread 1-5) Root resource classes found:
    class uk.package.test.myproject.api.NotificationApi
    class uk.package.test.myproject.api.UserApi
    class uk.package.test.myproject.api.FlagsApi
    class uk.package.test.myproject.api.UnitsByFunctionApi
    class uk.package.test.myproject.api.CvDataApi
    class uk.package.test.myproject.api.ImageApi
    class uk.package.test.myproject.api.GazetteerApi
    class uk.package.test.myproject.api.SearchApi
    class uk.package.test.myproject.api.ViewApi
    class uk.package.test.myproject.api.AdminApi
  10:46:48,776 INFO  [com.sun.jersey.api.core.ScanningResourceConfig] (MSC service thread 1-5) No provider classes found.
  10:46:48,834 INFO  [com.sun.jersey.server.impl.cdi.CDIComponentProviderFactoryInitializer] (MSC service thread 1-5) CDI support is enabled
  10:46:48,842 INFO  [com.sun.jersey.server.impl.application.WebApplicationImpl] (MSC service thread 1-5) Initiating Jersey application, version 'Jersey: 1.11.1 03/31/2012 06:49 PM'
  </code></pre>
  
  <p>Thank you in advance</p>
  
  <p>Cheers</p>
  
  <p>Martin</p>