0

I am trying to build maven jersey project, I am getting a clean build. But while running it on tomcat I am getting the following error

SEVERE: Servlet [Jersey REST Service] in web application [/dev-clinicaltextanalysis] threw load() exception java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer

This is pom.xml and I have added all the relevant jersey dependencies.

<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/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.cerner</groupId>
      <artifactId>dev-clinicaltextanalysis</artifactId>
      <packaging>war</packaging>
      <version>0.0.1-SNAPSHOT</version>
      <name>dev-clinicaltextanalysis Maven Webapp</name>
      <url>http://maven.apache.org</url>
      <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>

      <!-- https://mvnrepository.com/artifact/com.sun.jersey/jersey-server -->
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-server</artifactId>
        <version>1.8</version>
    </dependency>

            <dependency>
                <groupId>com.sun.jersey.contribs</groupId>
                <artifactId>jersey-multipart</artifactId>
                <version>1.8</version>
            </dependency> 
            <dependency>
                  <groupId>org.apache.pdfbox</groupId>
                  <artifactId>pdfbox</artifactId>
                  <version>2.0.8</version>
            </dependency>
            <dependency>
                <groupId>org.jvnet</groupId>
                <artifactId>mimepull</artifactId>
                <version>1.4</version>
            </dependency>

      </dependencies>
      <build>
        <finalName>dev-clinicaltextanalysis</finalName>
        <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.6</source>
                        <target>1.6</target>
                    </configuration>
                </plugin>
            </plugins>
      </build>
    </project>

And here is web.xml

<web-app id="WebApp_ID" version="2.4"
    xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>Restful Web Application</display-name>
     <welcome-file-list>  
       <welcome-file>index.html</welcome-file>   
      </welcome-file-list>
    <servlet> 
        <servlet-name>Jersey REST Service</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.sample.jerseydemo</param-value> </init-param> 

             <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping>

                <servlet-name>Jersey REST Service</servlet-name> 
                 <url-pattern>/rest/*</url-pattern>
                 </servlet-mapping> 
     </web-app>

Can anyone help in solving this issue. I have clean install built and also cleaned the server as well.

vindev
  • 2,240
  • 2
  • 13
  • 20
supreet singh
  • 79
  • 1
  • 7

0 Answers0