title: Jersey 2.26 - NoSuchFieldError when starting server
body: <p>I'm trying to setup a simple server using Jersey and Jetty. However the code from <a href="https://jersey.github.io/documentation/latest/deployment.html#deployment.http" rel="nofollow noreferrer">Jersey documentation</a> throws this error:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoSuchFieldError: GIT_HASH
  at org.eclipse.jetty.server.Server.doStart(Server.java:370)
  at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
  at org.glassfish.jersey.jetty.JettyHttpContainerFactory.createServer(JettyHttpContainerFactory.java:305)
  at org.glassfish.jersey.jetty.JettyHttpContainerFactory.createServer(JettyHttpContainerFactory.java:135)
  at com.zoho.dfs.App.main(App.java:17)
  </code></pre>
  
  <p>Here's my <code>App.java</code> class:</p>
  
  <pre><code>public class App
  {
      public static void main(String[] args) {
  
          URI baseUri = UriBuilder.fromUri("http://127.0.0.1/").port(8050).build();
          ResourceConfig config = new ResourceConfig(RestController.class);
          Server server = JettyHttpContainerFactory.createServer(baseUri, config);
  
          try {
              server.start();
              server.join();
          } catch (Exception e) {
              e.printStackTrace();
          }
  
      }
  }
  </code></pre>
  
  <p>and <code>RestController.class</code> (I want to map an</p>
  
  <pre><code>@Path("/{username}")
  public class RestController {
  
      @GET
      @Path("/home")
      @Produces(MediaType.APPLICATION_JSON)
      public Response read(@PathParam("username") String username) {
          String name = "hello " + username;
  
          return Response.status(200).entity(name).build();
      }
  }
  </code></pre>
  
  <p>and here's the <code>pom.xml</code> dependencies:</p>
  
  <pre><code>&lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.eclipse.jetty&lt;/groupId&gt;
          &lt;artifactId&gt;jetty-server&lt;/artifactId&gt;
          &lt;version&gt;9.4.8.v20171121&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.eclipse.jetty&lt;/groupId&gt;
          &lt;artifactId&gt;jetty-servlet&lt;/artifactId&gt;
          &lt;version&gt;9.4.8.v20171121&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-container-jetty-http&lt;/artifactId&gt;
          &lt;version&gt;2.26&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-media-moxy&lt;/artifactId&gt;
          &lt;version&gt;2.26&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.json&lt;/groupId&gt;
          &lt;artifactId&gt;json&lt;/artifactId&gt;
          &lt;version&gt;20180130&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.inject&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-hk2&lt;/artifactId&gt;
          &lt;version&gt;2.26&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>I tried with adding dependencies like <code>jersey-server</code>, <code>jersey-container-servlet-core</code> etc also. It's the same error. What could be mistake I'm doing? </p>