java.lang.ClassNotFoundException:com.sun.jersey.spi.container.servlet.ServletContainer JERSEY错误

时间:2018-01-23 11:50:27

标签: java eclipse maven jersey dependencies

我正在尝试建立maven jersey项目,我正在进行干净的构建。但是在tomcat上运行时我收到以下错误

  

SEVERE:Web应用程序中的Servlet [Jersey REST Service]   [/ dev-clinicaltextanalysis]抛出load()异常   抛出java.lang.ClassNotFoundException:   com.sun.jersey.spi.container.servlet.ServletContainer

这是 pom.xml ,我添加了所有相关的球衣依赖项。

<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>

这是 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>

任何人都可以帮助解决这个问题。我已经构建了干净安装,并且还清理了服务器。

0 个答案:

没有答案