ClassNotFoundException : Com.Sun.Jersey.Spi.Container.Servlet.ServletContainer

我是用Eclipse+maven+tomcat进行的本地maven项目练习,是新手,我也不知道为什么这么配就可以了,但是在我电脑上他就OK了,如果有人可以帮我改进方法,请回复赐教。

web.xml 中配置:

xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>aadisplay-name>
  <welcome-file-list>
    <welcome-file>index.jspwelcome-file>
    <welcome-file>default.htmlwelcome-file>
    <welcome-file>default.htmwelcome-file>
    <welcome-file>default.jspwelcome-file>
  welcome-file-list>
<servlet>
  <servlet-name>Jersey REST Serviceservlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainerservlet-class> 
  <init-param>
     <param-name>com.sun.jersey.config.property.packagesparam-name> 
    <param-value>mTestparam-value>
  init-param>
  <load-on-startup>1load-on-startup>
servlet>
<servlet-mapping>
  <servlet-name>Jersey REST Serviceservlet-name>
  <url-pattern>/rest/*url-pattern>
servlet-mapping>
 
web-app

pom.xml中代码如下:
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  4.0.0
  chc
  maven
  war
  0.0.1-SNAPSHOT
  maven Maven Webapp
  http://maven.apache.org
 
   
      junit
      junit
      3.8.1
      test
   

    
     
    com.sun.jersey
    jersey-server
    1.17.1


    com.sun.jersey
    jersey-core
    1.17.1


    com.sun.jersey
    jersey-servlet
    1.17.1

 

 
    maven
 



将解压 jersey-archive-1.18后生成的文件夹下的lib与contribs下的jar文件粘贴到WEB-INF中的lib文件夹下,要是没有lib文件夹,手动建一个。

你可能感兴趣的:(ClassNotFoundException : Com.Sun.Jersey.Spi.Container.Servlet.ServletContainer)