2017-06-12 58 views
0

我試圖運行我的Apache TomCat7服務器上的程序,但我得到了以下異常:重度:在Servlet的Web應用程序拋出負載()異常拋出java.lang.ClassNotFoundException但的.class是路徑

SEVERE: Servlet [ConfigServlet] in web application [/asdf] threw load() exception java.lang.ClassNotFoundException: com.x.y.z.servlet.MainConfigServlet 
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1858) 
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701) 
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:504) 
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:486) 
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:113) 
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1146) 
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1085) 
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5318) 
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5610) 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) 
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572) 
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562) 
at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
at java.lang.Thread.run(Thread.java:745) 

但是當我檢查目標時,我在.war文件中找到MainConfigServlet.class。部署程序集,Java Build Path等都沒有問題,但仍然無法找到確切的問題。

回答

0

在web.xml中爲servlet的指定確切的類名 「ConfigServlet」

<servlet> 
<servlet-name>ConfigServlet</servlet-name> 
<servlet-class>com.x.y.z.servlet.MainConfigServlet</servlet-class> 
</servlet> 
相關問題