错误信息如下:
javax.servlet.ServletException: Servlet.init() for servlet dwr-invoker threw exception
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Unknown Source)
root cause
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
org.directwebremoting.dwrp.PollHandler.<clinit>(PollHandler.java:382)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Unknown Source)
org.directwebremoting.impl.ContainerUtil.class$(ContainerUtil.java:97)
org.directwebremoting.impl.ContainerUtil.setupDefaults(ContainerUtil.java:150)
org.directwebremoting.impl.ContainerUtil.setupDefaultContainer(ContainerUtil.java:125)
org.directwebremoting.servlet.DwrServlet.init(DwrServlet.java:73)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Unknown Source)
root cause
java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1360)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
java.lang.ClassLoader.loadClassInternal(Unknown Source)
org.directwebremoting.dwrp.PollHandler.<clinit>(PollHandler.java:382)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Unknown Source)
org.directwebremoting.impl.ContainerUtil.class$(ContainerUtil.java:97)
org.directwebremoting.impl.ContainerUtil.setupDefaults(ContainerUtil.java:150)
org.directwebremoting.impl.ContainerUtil.setupDefaultContainer(ContainerUtil.java:125)
org.directwebremoting.servlet.DwrServlet.init(DwrServlet.java:73)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Unknown Source)
*********************************************************************************************************************************
解决方法:这个问题,我一开始也被折腾了好久,后来发现,其实很简单,只是我少引用了一个包,那就是commons-logging-1.0.4.jar包,这个包你可以先去下载个dwr-2.0.4-src.zip,里面就含有这个包,然后,你把commons-logging-1.0.4.jar这个包放到你的wEB-INF下的lib文件夹下,再运行试试
联系客服