0

I have downloaded and imported jars of jersey 1.16, jersey 1.17 and jersey2.23 version separately and together(jersey 2.23 and jersey 1.16). The code gets compiled properly but getting the above error when I try to deploy on Tomcat 7.

I have referred the following tutorials:

  1. RESTful Java client with Jersey client

  2. Implementing RESTFul service with Java

If I use only jersey 2.23 jar then it's throwing error. When I import and use Client package hence I added Jersey-Client-1.2.jar to avoid those error and I also added jersey-container-servlet-core jar to Tomcat lib folder. But error is still existing. Error :

java.lang.ClassNotFoundException: 
com.sun.jersey.spi.container.servlet.ServletContainer
WitVault
  • 23,445
  • 19
  • 103
  • 133
deepti mullur
  • 569
  • 1
  • 4
  • 14
  • Check this links:http://www.mkyong.com/webservices/jax-rs/classnotfoundexception-com-sun-jersey-spi-container-servlet-servletcontainer/ and http://stackoverflow.com/questions/18086218/java-lang-classnotfoundexception-com-sun-jersey-spi-container-servlet-servletco – soorapadman Jul 11 '16 at 09:38
  • I have tried all of those solution and still not working. – deepti mullur Jul 11 '16 at 10:08

1 Answers1

0

To solve this issue, correct the project dependencies in pom.xml like below. If you are not using maven for project dependencies, include the corresponding jar files in classpath.

<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-server</artifactId>
    <version>1.17.1</version>
</dependency>
<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-core</artifactId>
    <version>1.17.1</version>
</dependency>
<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-servlet</artifactId>
    <version>1.17.1</version>
</dependency>
soorapadman
  • 4,451
  • 7
  • 35
  • 47