ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer

Проблема

В разработке на Джерси нажмите следующее сообщение об ошибке на Tomcat.

SEVERE: Servlet/RESTfulExample threw load() exception
  java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer

  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
 //...

Вот Maven pom.xml

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-core</artifactId>
        <version>1.8</version>
    </dependency>

Решение

« Com.sun.jersey.spi.container.servlet.ServletContainer » включен в «jersey-server.jar», а не в «jersey-core.jar».

На самом деле, для разработки сервиса REST с помощью Jersey вам просто нужно включить «jersey-server.jar», он автоматически загрузит зависимость «jersey-core.jar».

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-server</artifactId>
        <version>1.8</version>
    </dependency>

ссылка://тег/jax-rs/[jax-rs]ссылка://тег/джерси/[джерси]