我正在創建一個REstfulwebservices項目。當我要運行這個 項目時,我得到這個錯誤。 ClassNot FoundException ... ServletAdaptor
問題。ClassNotFoundException,缺少ServletContainerAdaptor
SEVERE: Servlet /XybuyProject threw load() exception
java.lang.ClassNotFoundException:
com.sun.jersey.server.spi.container.servlet.ServletAdaptor
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1048)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:996)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4834)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5155)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5150)
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)
這是在web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns
/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>FirstProject</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index2.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>ServletAdaptor</servlet-name>
<servlet-class>
com.sun.jersey.server.spi.container.servlet.ServletAdaptor
</servlet-class>
<init-param>
<param-name>com.sun.jersy.config.property.packages</param-name>
<param-value>com.xybuy.webservice</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ServletAdaptor</servlet-name>
<url-pattern>/REST/*</url-pattern>
</servlet-mapping>
</web-app>
可你電話我背後是什麼問題.....
你可以檢查特定的類(jar)是否在類路徑中可用?...只有在服務器找不到特定類的情況下才會發現類未發現異常。 – Ratha