tomcat 继承错误
xgs1983
|
1#
xgs1983 发表于 2008-11-16 10:08
tomcat 继承错误
我要继承tomcat 的WebdavServlet 类,
package com.ponder.web; import java.io.IOException; import java.util.Enumeration; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.catalina.servlets.DefaultServlet; import org.apache.catalina.servlets.WebdavServlet; public class MyWebDavServlet extends WebdavServlet{ /** * */ private static final long serialVersionUID = 1L; public void init() throws ServletException{ System.out.println("OK-Init"); super.init(); } @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException{ System.out.println("process start : " + request.getRequestURL().toString()); System.out.println("OK-Init"); super.service(request, response); System.out.println("process over : " + request.getRequestURL().toString()); } } 发布到tomcat起动正常 一访问就出报出错误如下 OK-Init 2008-11-16 10:07:03 org.apache.catalina.core.ApplicationContext log 严重: StandardWrapper.Throwable java.lang.ClassCastException: org.apache.naming.resources.ProxyDirContext cannot be cast to org.apache.naming.resources.ProxyDirContext at org.apache.catalina.servlets.DefaultServlet.init(DefaultServlet.java:256) at org.apache.catalina.servlets.WebdavServlet.init(WebdavServlet.java:263) at com.ponder.web.MyWebDavServlet.init(MyWebDavServlet.java:25) at javax.servlet.GenericServlet.init(GenericServlet.java:212) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161) at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:806) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Unknown Source) 2008-11-16 10:07:03 org.apache.catalina.core.StandardWrapperValve invoke 严重: Allocate exception for servlet webdav java.lang.ClassCastException: org.apache.naming.resources.ProxyDirContext cannot be cast to org.apache.naming.resources.ProxyDirContext at org.apache.catalina.servlets.DefaultServlet.init(DefaultServlet.java:256) at org.apache.catalina.servlets.WebdavServlet.init(WebdavServlet.java:263) at com.ponder.web.MyWebDavServlet.init(MyWebDavServlet.java:25) at javax.servlet.GenericServlet.init(GenericServlet.java:212) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161) at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:806) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Unknown Source)。 web.xml如下 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <servlet> <servlet-name>webdav </servlet-name> <servlet-class>com.ponder.web.MyWebDavServlet </servlet-class> <init-param> <param-name>debug </param-name> <param-value>0 </param-value> </init-param> <init-param> <param-name>listings </param-name> <param-value>true </param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>webdav </servlet-name> <url-pattern>/* </url-pattern> </servlet-mapping> </web-app> 请问我要如何解决哎 |