title: Jetty, Jersey, & Maven - Spring Error
body: <p>So I recently started using maven to manage dependencies, and started trying to use Jersey to build a REST API. I came across a fantastic tutorial <a href="https://nikolaygrozev.wordpress.com/2014/10/16/rest-with-embedded-jetty-and-jersey-in-a-single-jar-step-by-step/" rel="nofollow noreferrer">here</a>. A similar StackOverFlow question was posted <a href="https://stackoverflow.com/questions/22738497/how-do-i-update-example-to-work-with-latest-versions-jetty-9-1-0-rc2-and-jerse">here</a>, and the first accepted response has the same maven script.</p>
  
  <p>The server I will be deploying to is Jetty, so I've installed the eclipse plugin for Jetty (<strong>Eclipse Jetty 3.8.0</strong> which uses <strong>Jetty-9.2.5</strong>) and have had no problems using it for just servlets in the past. I do the <em>Maven - Clean</em> &amp; <em>Maven - Install</em> when I modify that pom.xml file, and everything <em>appears</em> to be listed appropriate in the class path shown on startup.</p>
  
  <p>So I'm not too sure why it does not see that SpringServlet. Furthermore, why in the links provided above, do they reference GlassFish modules, when they're primarily using Jetty?</p>
  
  <p><strong>pom.xml</strong></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;com.foo&lt;/groupId&gt;
    &lt;artifactId&gt;JerseyTest&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;war&lt;/packaging&gt;
      &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.2.5.v20141112&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.2.5.v20141112&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.core&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-server&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;/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.7&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.7&lt;/version&gt;
        &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <pre><code>2015-02-05 09:26:09.624:INFO::main: Logging initialized @102ms
     Configuration: /var/folders/25/_t5gg17n7577_b94gh4nkh700000gn/T/eclipseJettyPlugin.config.JerseyTest.xml
           Version: 9.2.5.v20141112
           Context: /
              Port: 8080
         Classpath: /Users/me/.m2/repository/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar
                    /Users/me/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar
                    /Users/me/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar
                    /Users/me/.m2/repository/javax/ws/rs/javax.ws.rs-api/2.0/javax.ws.rs-api-2.0.jar
                    /Users/me/.m2/repository/org/eclipse/jetty/jetty-continuation/9.1.1.v20140108/jetty-continuation-9.1.1.v20140108.jar
                    /Users/me/.m2/repository/org/eclipse/jetty/jetty-http/9.2.5.v20141112/jetty-http-9.2.5.v20141112.jar
                    /Users/me/.m2/repository/org/eclipse/jetty/jetty-io/9.2.5.v20141112/jetty-io-9.2.5.v20141112.jar
                    /Users/me/.m2/repository/org/eclipse/jetty/jetty-security/9.2.5.v20141112/jetty-security-9.2.5.v20141112.jar
                    /Users/me/.m2/repository/org/eclipse/jetty/jetty-server/9.2.5.v20141112/jetty-server-9.2.5.v20141112.jar
                    /Users/me/.m2/repository/org/eclipse/jetty/jetty-servlet/9.2.5.v20141112/jetty-servlet-9.2.5.v20141112.jar
                    /Users/me/.m2/repository/org/eclipse/jetty/jetty-util/9.2.5.v20141112/jetty-util-9.2.5.v20141112.jar
                    /Users/me/.m2/repository/org/eclipse/persistence/org.eclipse.persistence.antlr/2.5.0/org.eclipse.persistence.antlr-2.5.0.jar
                    /Users/me/.m2/repository/org/eclipse/persistence/org.eclipse.persistence.asm/2.5.0/org.eclipse.persistence.asm-2.5.0.jar
                    /Users/me/.m2/repository/org/eclipse/persistence/org.eclipse.persistence.core/2.5.0/org.eclipse.persistence.core-2.5.0.jar
                    /Users/me/.m2/repository/org/eclipse/persistence/org.eclipse.persistence.moxy/2.5.0/org.eclipse.persistence.moxy-2.5.0.jar
                    /Users/me/.m2/repository/org/glassfish/hk2/external/aopalliance-repackaged/2.2.0/aopalliance-repackaged-2.2.0.jar
                    /Users/me/.m2/repository/org/glassfish/hk2/external/javax.inject/2.2.0/javax.inject-2.2.0.jar
                    /Users/me/.m2/repository/org/glassfish/hk2/hk2-api/2.2.0/hk2-api-2.2.0.jar
                    /Users/me/.m2/repository/org/glassfish/hk2/hk2-locator/2.2.0/hk2-locator-2.2.0.jar
                    /Users/me/.m2/repository/org/glassfish/hk2/hk2-utils/2.2.0/hk2-utils-2.2.0.jar
                    /Users/me/.m2/repository/org/glassfish/hk2/osgi-resource-locator/1.0.1/osgi-resource-locator-1.0.1.jar
                    /Users/me/.m2/repository/org/glassfish/jersey/bundles/repackaged/jersey-guava/2.7/jersey-guava-2.7.jar
                    /Users/me/.m2/repository/org/glassfish/jersey/containers/jersey-container-jetty-http/2.7/jersey-container-jetty-http-2.7.jar
                    /Users/me/.m2/repository/org/glassfish/jersey/containers/jersey-container-servlet-core/2.7/jersey-container-servlet-core-2.7.jar
                    /Users/me/.m2/repository/org/glassfish/jersey/core/jersey-client/2.7/jersey-client-2.7.jar
                    /Users/me/.m2/repository/org/glassfish/jersey/core/jersey-common/2.7/jersey-common-2.7.jar
                    /Users/me/.m2/repository/org/glassfish/jersey/core/jersey-server/2.7/jersey-server-2.7.jar
                    /Users/me/.m2/repository/org/glassfish/jersey/ext/jersey-entity-filtering/2.7/jersey-entity-filtering-2.7.jar
                    /Users/me/.m2/repository/org/glassfish/jersey/media/jersey-media-moxy/2.7/jersey-media-moxy-2.7.jar
                    /Users/me/.m2/repository/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar
                    /Users/me/Documents/workspace/JerseyTest/target/classes
  2015-02-05 09:26:09.967:INFO:oejs.Server:main: jetty-9.2.5.v20141112
  2015-02-05 09:26:11.199:WARN:oeja.AnnotationConfiguration:main: ServletContainerInitializers: detected. Class hierarchy: empty
  2015-02-05 09:26:11.382:WARN:oejs.SecurityHandler:main: ServletContext@o.e.j.w.WebAppContext@1ed4004b{/,file:/Users/me/Documents/workspace/JerseyTest/src/main/webapp/,STARTING}{/Users/me/Documents/workspace/JerseyTest/src/main/webapp} has uncovered http methods for path: /
  2015-02-05 09:26:11.412:WARN:oejs.BaseHolder:main: 
  java.lang.ClassNotFoundException: com.sun.jersey.spi.spring.container.servlet.SpringServlet
  </code></pre>
  
  <p><strong>web.xml</strong></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://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"&gt;
  
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;rest.service&lt;/servlet-name&gt;
      &lt;servlet-class&gt;
          com.sun.jersey.spi.spring.container.servlet.SpringServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;com.sun.jersey.config.property.resourceConfigClass&lt;/param-name&gt;
          &lt;param-value&gt;com.sun.jersey.api.core.PackagesResourceConfig&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;com.sun.jersey.config.property.packages&lt;/param-name&gt;
          &lt;param-value&gt;com.foo.servlets&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;rest.service&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/service/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Thanks!</p>