When I'm attempting to build a simple test application in Eclipse using Jersey. When I try to run my app I get this exception:
java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer
I've researched answers to this question here on Stack Overflow and have verified these things:
It is true that the missing class does not exists in jersey-server any more. That class now exists in jersey-servlet (Notice "servlet", not "server"). So my maven dependencies now look like this:
<dependencies>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.19</version>
</dependency>
</dependencies>
And my web.xml looks like this
<servlet>
<servlet-name>jersey-helloworld-serlvet</servlet-name>
<servlet-class>
com.sun.jersey.spi.container.servlet.ServletContainer
</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.javacodegeeks.enterprise.rest.jersey</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jersey-helloworld-serlvet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
I can now look at my project in Eclipse and under Java Resources/Libraries/Maven Dependencies I can see the file jersey-servlet-1.19.jar and in that jar I can see the com.sun.jersey.spi.container.servlet package and within that package I can see the ServletContainer.class file.
So everything appears to be correct, and yet when the server (apache 7.0) starts it can't find the class which is clearly there.
Thank you for any advice you may have.