title: Tomcat Jersey Eclipse ClassNotFound org.glassfish.jersey.servlet.ServletContainer
body: <p>I am running the <a href="http://www.mkyong.com/webservices/jax-rs/jersey-hello-world-example/" rel="nofollow">hello world</a> example.</p>
  
  <p>However, I am using version 2.7.</p>
  
  <p>on maven pom.xml I have </p>
  
  <pre class="lang-xml prettyprint-override"><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;com.mydomain.restful&lt;/groupId&gt;
  &lt;artifactId&gt;AdvertServer&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;name&gt;Advert Server&lt;/name&gt;
  
  &lt;dependencyManagement&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-bom&lt;/artifactId&gt;
              &lt;version&gt;2.7&lt;/version&gt;
              &lt;type&gt;pom&lt;/type&gt;
              &lt;scope&gt;import&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/dependencyManagement&gt;
  
  &lt;dependencies&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.2.4&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax&lt;/groupId&gt;
          &lt;artifactId&gt;javaee-web-api&lt;/artifactId&gt;
          &lt;version&gt;6.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.ws.rs&lt;/groupId&gt;
          &lt;artifactId&gt;javax.ws.rs-api&lt;/artifactId&gt;
          &lt;version&gt;2.0&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.core&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-client&lt;/artifactId&gt;
          &lt;version&gt;2.7&lt;/version&gt;
      &lt;/dependency&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;version&gt;2.7&lt;/version&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;/dependencies&gt;
  
  &lt;build&gt;
      &lt;sourceDirectory&gt;src&lt;/sourceDirectory&gt;
      &lt;resources&gt;
          &lt;resource&gt;
              &lt;directory&gt;src&lt;/directory&gt;
              &lt;excludes&gt;
                  &lt;exclude&gt;**/*.java&lt;/exclude&gt;
              &lt;/excludes&gt;
          &lt;/resource&gt;
      &lt;/resources&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.0&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.7&lt;/source&gt;
                  &lt;target&gt;1.7&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>I tried running the servlet from command line and from withing the Server plugin on Eclipse. I get the same error:</p>
  
  <pre><code>java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
      at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:525)
      at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:507)
      at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:126)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1043)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4957)
      at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5284)
      at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5279)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:722)
  </code></pre>
  
  <p>The weird thing is that I can see the class among the .jar files. The class is there.</p>
  
  <p>I have even tried adding the jar skipping maven, but Tomcat won't see the class.</p>