Restful Web Service在Shell中运行但不是Eclipse indigo,它给出了class not found异常

时间:2013-08-10 18:36:07

标签: eclipse web-services jersey-1.0

我正在使用Eclipse INDIGO,Apache-tomcat-7.0.42和jersay库。我将我的项目作为war导出到\ apache-tomcat-7.0.42 \ webapps文件夹并从cmd运行服务器,它不会抛出任何异常。但是当我尝试在服务器上运行我的项目时,它会给出以下异常

Aug 10, 2013 11:29:48 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.42
Aug 10, 2013 11:29:48 PM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet Jersey-Servlet as unavailable
Aug 10, 2013 11:29:48 PM org.apache.catalina.core.StandardContext loadOnStartup
: Servlet /sc threw load() exception
java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer
at            .apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:527)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:509)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:137)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1144)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176)
at    org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460)
   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
   at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

当我在网上搜索我的错误时,我发现了泽西图书馆的一些问题..但我找不到任何解决方案。我添加这个库。但它给出了同样的错误。

Jersey的servlet的1.13-b01.jar

Jersey的servlet的1.17.1.jar

球衣束-1.17.1.jar

请帮助我....

1 个答案:

答案 0 :(得分:0)

你需要添加jersey-core.jar

请参阅mykyong.com same issue resolution