title: How to implement jaxrs Application without web.xml
body: <p>I am trying to deploy a really simple jaxrs application with without a web.xml config and cannot get it working. My URL I'd expect to access is serverandport/{appname}/rest/welcomes/hello and I think I must be missing something dead obvious.</p>
  
  <p>Application</p>
  
  <pre><code>@ApplicationPath("/rest")
  public class EngineApp extends Application {
  
      @Override
      public Set&lt;Class&lt;?&gt;&gt; getClasses() {
          Set&lt;Class&lt;?&gt;&gt; s = new HashSet&lt;Class&lt;?&gt;&gt;();
          s.add(RestTestImpl.class);
          return s;
      }
  
  }
  </code></pre>
  
  <p>Resource</p>
  
  <pre><code>@Path("/welcomes")
  public class RestTestImpl {
      @GET
      @Path("hello")
      public String sayPlainHello() {
          return "Hi from Rest";
      }
  }
  </code></pre>
  
  <p>POM snippet</p>
  
  <p></p>
  
  <pre><code>&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
      &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
      &lt;version&gt;2.1.1&lt;/version&gt;
      &lt;configuration&gt;
          &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;
      &lt;/configuration&gt;
  </code></pre>
  
  <p>Edit: Further to the response below, I tried with an empty web.xml and also with the following web.xml. Bother also return 404, however the xml below states "Servlet javax.ws.rs.core.Application is not available":</p>
  
  <p>web.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      version="3.0"
      xmlns="http://java.sun.com/xml/ns/javaee"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
        http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" &gt;
      &lt;servlet&gt; 
          &lt;servlet-name&gt;javax.ws.rs.core.Application&lt;/servlet-name&gt; 
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; 
      &lt;/servlet&gt; 
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;javax.ws.rs.core.Application&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
  &lt;/web-app&gt;
  </code></pre>