title: Spring Jersey 2.7: java.lang.ClassNotFoundException: com.sun.jersey.spi.spring.container.servlet.SpringServlet
body: <p>I am referring to <a href="http://www.mkyong.com/webservices/jax-rs/jersey-spring-integration-example/" rel="nofollow">this</a> article</p>
  
  <p>My <code>web.xml</code> looks like </p>
  
  <pre><code>&lt;web-app&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;classpath:applicationContext.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;InventoryApplication&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.packages
              &lt;/param-name&gt;
              &lt;param-value&gt;com.org.me_services.inventory.services&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;InventoryApplication&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/rest/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>and maven dependencies as </p>
  
  <pre><code>&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.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
              &lt;version&gt;4.0.3.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.ext&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-spring3&lt;/artifactId&gt;
              &lt;version&gt;2.8&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                      &lt;artifactId&gt;spring&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
                  &lt;!--
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
  --&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
                      &lt;!--&lt;artifactId&gt;*&lt;/artifactId&gt;--&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.sun.jersey.test.framework&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-test-framework&lt;/artifactId&gt;
              &lt;version&gt;1.0.3.1&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>the resource class is</p>
  
  <pre><code>@Component
  @Path("/inv")
  public class HelloResource {
  
      @GET
      @Path("/hello")
      public Response hello() {
          System.out.println("REQUEST RECEIVED");
          return Response.accepted().build();
  
      }
  }
  </code></pre>
  
  <p>I deploy this on <code>Tomcat 7x</code> and see errors as</p>
  
  <pre><code>[INFO] [talledLocalContainer] INFO: Marking servlet com.org.me_services.inventory.services.InventoryApplication as unavailable
  [INFO] [talledLocalContainer] May 04, 2014 9:52:03 AM org.apache.catalina.core.StandardContext loadOnStartup
  [INFO] [talledLocalContainer] SEVERE: Servlet /services threw load() exception
  [INFO] [talledLocalContainer] java.lang.ClassNotFoundException: com.sun.jersey.spi.spring.container.servlet.SpringServlet
  [INFO] [talledLocalContainer]   at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
  [INFO] [talledLocalContainer]   at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
  [INFO] [talledLocalContainer]   at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:529)
  [INFO] [talledLocalContainer]   at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:511)
  [INFO] [talledLocalContainer]   at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:139)
  [INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1148)
  [INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
  [INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210)
  [INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5493)
  [INFO] [talledLocalContainer]   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  [INFO] [talledLocalContainer]   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
  [INFO] [talledLocalContainer]   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
  [INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
  [INFO] [talledLocalContainer]   at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073)
  [INFO] [talledLocalContainer]   at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
  [INFO] [talledLocalContainer]   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
  [INFO] [talledLocalContainer]   at java.util.concurrent.FutureTask.run(FutureTask.java:262)
  [INFO] [talledLocalContainer]   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  [INFO] [talledLocalContainer]   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  [INFO] [talledLocalContainer]   at java.lang.Thread.run(Thread.java:745)
  [INFO] [talledLocalContainer] 
  </code></pre>