title: Swagger integration(RestEasy 3.x + WildFly) - 404 Could not find resource
body: <p>I'm trying to include Swagger into my project.
  I'm using WildFly (10) server with RestEasy 3.0.11, my resources are EJB-powered and the whole project is building with Ant.</p>
  
  <p>Swagger dependencies are provided by WildFly modules.</p>
  
  <p>The problem is when I'm trying to get swagger.json (via <em><a href="http://localhost:8080/app/api/swagger.json" rel="nofollow noreferrer">http://localhost:8080/app/api/swagger.json</a></em> but I've tried other variants of it as well) I've got a 404 response/blank page in the browser and following console output:</p>
  
  <pre><code>09:40:49,893 WARN  [org.jboss.resteasy.core.ExceptionHandler] (Log4jLogger.java:135) failed to execute: javax.ws.rs.NotFoundException: Could not find resource for full path: http://localhost:8080/app/api/swagger.json
  at org.jboss.resteasy.core.registry.SegmentNode.match(SegmentNode.java:112)
  at org.jboss.resteasy.core.registry.RootNode.match(RootNode.java:43)
  at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.java:48)
  at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:444)
  at org.jboss.resteasy.core.SynchronousDispatcher.getInvoker(SynchronousDispatcher.java:234)
  at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:171)
  at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220)
  at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
  at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
  at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:86)
  at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
  at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
  at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
  at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
  at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
  at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
  at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
  at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
  at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:72)
  at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
  at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
  at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
  at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:282)
  at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:261)
  at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:80)
  at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:172)
  at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
  at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:748)
  </code></pre>
  
  <p>The <em>web.xml</em> configuration is as follows:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  
  &lt;web-app&gt;
  
      &lt;display-name&gt;app&lt;/display-name&gt;
      &lt;description&gt;app&lt;/description&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;resteasy.scan&lt;/param-name&gt;
          &lt;param-value&gt;true&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;javax.ws.rs.core.Application&lt;/servlet-name&gt;
          &lt;url-pattern&gt;*.json&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;SwaggerServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;my.example.app.examples.web.SwaggerServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;2&lt;/load-on-startup&gt;
      &lt;/servlet&gt; 
  &lt;/web-app&gt;
  </code></pre>
  
  <p>And here's a SwaggerServlet mentioned above: </p>
  
  <pre><code>import io.swagger.config.ScannerFactory;
  import io.swagger.jaxrs.config.BeanConfig;
  import io.swagger.jaxrs.config.DefaultJaxrsScanner;
  import io.swagger.jaxrs.config.SwaggerContextService;
  
  import javax.servlet.ServletConfig;
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  
  import org.jboss.logging.Logger;
  
  public class SwaggerServlet extends HttpServlet {
      private static Logger log = Logger.getLogger(SwaggerServlet.class);
  
      @Override
      public void init(ServletConfig config) throws ServletException {
          try {
              super.init(config);
  
              BeanConfig beanConfig = new BeanConfig();
              beanConfig.setVersion("1.0.0");
              beanConfig.setSchemes(new String[] { "http" });
              beanConfig.setHost("localhost:8080");
              beanConfig.setBasePath("/api");
              beanConfig.setResourcePackage("io.swagger.resources,io.swagger.jaxrs.listing,my.example.app.exampleresources");
              beanConfig.setScan(true);
              log.info("Swagger servlet has been initialized");
          } catch (ServletException e) {
              log.error(e);
          }
  
      }
  }
  </code></pre>
  
  <p>And while starting my application the servlet seems to initialize:</p>
  
  <pre><code>09:40:33,809 INFO  [my.example.app.examples.web.SwaggerServlet] (SwaggerServlet.java:40) Swagger servlet has been initialized
  </code></pre>
  
  <p>My web resource is working and responding properly (on <em><a href="http://localhost:8080/app/example/listOfExampleResources.json" rel="nofollow noreferrer">http://localhost:8080/app/example/listOfExampleResources.json</a></em>). The ExampleModel class is just a POJO:</p>
  
  <pre><code>@Api(value = "/app")
  
  @Stateless
  @Path("/app")
  @Consumes({ "application/json" })
  @Produces({ "application/json" })
  public class ExampleController {
  
      @GET
      @Path("/example/listOfExampleResources.json")
      @ApiOperation(value = "Get list of example resources", 
          notes = "Note test", 
          response = ExampleModel.class,
          responseContainer = "list"
      )
      @Produces("application/json")
      public List&lt;ExampleModel&gt; getList() {
          List&lt;ExampleModel&gt; list = new ArrayList&lt;ExampleModel&gt;();
          ExampleModel example = new ExampleModel();
          example.setName("Hello");
          list.add(example);
          return list;
      }
  }
  </code></pre>
  
  <p>I've tried other parameters and configuration approaches such as configuration via custom Application class, defining servlet inside web.xml, manual resources providing.
  I was replacing RestEasy with older version (3.0.4) as well - but all in all I'm still getting 404.</p>
  
  <p>Do you have any idea how can I get <em>swagger.json</em> resource?</p>
  
  <p>Thanks for your time.</p>