title: Do I need ApplicationConfig.java
body: <p>Trying to create my first simple web service in Eclipse by project name <code>WebServiceRestful_Server</code>. <code>DemoRest</code> class code:</p>
  
  <pre><code>package ws;
  
  import javax.ws.rs.*;
  import javax.ws.rs.core.*;
  
  
  @Path("demo")
  public class DemoRest {
  
      @GET
      @Path("hello")
      @Produces(MediaType.TEXT_PLAIN)
      public String hello()
      {
          return "Hello world";
  
      }
  
  }
  </code></pre>
  
  <p>According manual I found I need <code>ApplicationConfig</code> class. I did it:</p>
  
  <pre><code>package ws;
  
  import java.util.Set;
  import javax.ws.rs.core.Application;
  
  @javax.ws.rs.ApplicationPath("rest")
  public class ApplicationConfig extends Application {
  
      @Override
      public Set&lt;Class&lt;?&gt;&gt; getClasses() {
          Set&lt;Class&lt;?&gt;&gt; resources = new java.util.HashSet&lt;&gt;();
          addRestResourceClasses(resources);
          return resources;
      }
      private void addRestResourceClasses(Set&lt;Class&lt;?&gt;&gt; resources) {
          //add all resources classes
          resources.add(ws.DemoRest.class);
      }
  }
  </code></pre>
  
  <p>Run on server. But when I go to <code>http://localhost:8080/WebServiceRestful_Server/rest/demo/hello</code> I see only 
  <a href="https://i.stack.imgur.com/KlIOc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KlIOc.png" alt="enter image description here"></a></p>
  
  <p>How to get "Hello world" there?</p>
  
  <p>Do I need ApplicationConfig.java? Looks like this code is not run. I was try to place breakpoints on both functions, but nothing was happening on them, when I run in project in Debug mode.</p>
  
  <p>UPD:</p>
  
  <p>pom.xml</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;WebServiceRestful_Server&lt;/groupId&gt;
    &lt;artifactId&gt;WebServiceRestful_Server&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;war&lt;/packaging&gt;
    &lt;build&gt;
      &lt;sourceDirectory&gt;src&lt;/sourceDirectory&gt;
      &lt;plugins&gt;
        &lt;plugin&gt;
          &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
          &lt;version&gt;3.5.1&lt;/version&gt;
          &lt;configuration&gt;
            &lt;source&gt;1.8&lt;/source&gt;
            &lt;target&gt;1.8&lt;/target&gt;
          &lt;/configuration&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
          &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
          &lt;version&gt;3.0.0&lt;/version&gt;
          &lt;configuration&gt;
            &lt;warSourceDirectory&gt;WebContent&lt;/warSourceDirectory&gt;
          &lt;/configuration&gt;
        &lt;/plugin&gt;
      &lt;/plugins&gt;
    &lt;/build&gt;
    &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.j2ee&lt;/groupId&gt;
          &lt;artifactId&gt;j2ee&lt;/artifactId&gt;
      &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
      &lt;artifactId&gt;jersey-container-servlet&lt;/artifactId&gt;
      &lt;version&gt;2.25.1&lt;/version&gt;
      &lt;scope&gt;provided&lt;/scope&gt;
  &lt;/dependency&gt;
    &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <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" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"&gt;
    &lt;display-name&gt;WebServiceRestful_Server&lt;/display-name&gt;
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.jsp&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>