java.lang.NoClassDefFoundError: org/glassfish/jersey/internal/inject/Binder when started Tomcat Server : <p>I am building REST API in Java with Jersey and Maven. I used Tomcat 9 as my server. Everything works fine until I tried to install <strong>RestAssured,</strong> <strong>Hamcrest,</strong> and <strong>JUnit</strong> today. Suddenly all of my endpoints threw out 500 Internal server errors. The root cause of the 500 error is <code>java.lang.NoClassDefFoundError: org/glassfish/jersey/internal/inject/Binder.</code></p>

<p>What I have done this 2 hours: </p>

<ul>
<li>I have tried to find this class: <code>org/glassfish/jersey/internal/inject/Binder</code> on google, but no avail. </li>
<li>I have tried to uninstall <strong>RestAssured</strong>, <strong>Hamcrest</strong>, and <strong>JUnit</strong> but it didn't help. </li>
</ul>

<p>This problem makes me frustrated. Any idea why this errors happened? Thanks in advance!</p>

<p>Here is the excerpt of the server log:</p>

<blockquote>
  <p><strong>SEVERE: Allocate exception for servlet Jersey Web Application java.lang.ClassNotFoundException: org.glassfish.jersey.internal.inject.Binder</strong>
      at
  org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1275)
      at
  org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1109)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:178)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:370)
      at javax.servlet.GenericServlet.init(GenericServlet.java:158)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1183)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099)
      at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:779)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:133)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
      at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:341)
      at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:498)
      at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
      at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:796)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1368)
      at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Unknown Source)</p>
</blockquote>

<p>Below is my <code>pom.xml</code> file: (with RestAssured, Hamcrest, and JUnit)</p>

<pre><code>&lt;dependencies&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
        &lt;artifactId&gt;jersey-container-servlet-core&lt;/artifactId&gt;
        &lt;!-- use the following artifactId if you don't need servlet 2.x compatibility --&gt;
        &lt;!-- artifactId&gt;jersey-container-servlet&lt;/artifactId --&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;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
        &lt;artifactId&gt;gson&lt;/artifactId&gt;
        &lt;version&gt;2.8.0&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;mysql&lt;/groupId&gt;
        &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
        &lt;version&gt;5.1.6&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;4.12&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.hamcrest&lt;/groupId&gt;
        &lt;artifactId&gt;hamcrest-all&lt;/artifactId&gt;
        &lt;version&gt;1.3&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;com.jayway.restassured&lt;/groupId&gt;
        &lt;artifactId&gt;rest-assured&lt;/artifactId&gt;
        &lt;version&gt;2.9.0&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
&lt;/dependencies&gt;
</code></pre>

<p>Below is my web.xml file:</p>

<pre><code>&lt;web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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;Jersey Web Application&lt;/servlet-name&gt;
    &lt;servlet-class&gt;org.glassfish.jersey.servlet.ServletContainer&lt;/servlet-class&gt;
    &lt;init-param&gt;
        &lt;param-name&gt;jersey.config.server.provider.packages&lt;/param-name&gt;
        &lt;param-value&gt;com.accelbyte.vincent.emailist.resources&lt;/param-value&gt;
    &lt;/init-param&gt;
    &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
&lt;/servlet&gt;
&lt;servlet-mapping&gt;
    &lt;servlet-name&gt;Jersey Web Application&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/webapi/*&lt;/url-pattern&gt;
&lt;/servlet-mapping&gt;
</code></pre>

<p></p>

<p>Below is my project structure: </p>

<p><a href="https://i.stack.imgur.com/s95Al.png" rel="noreferrer">Email list project structure</a></p>
