一个安卓服务端程序起初部署在Tomcat6.0当中,但是当我用Tomcat8.0部署时,出现了一个错误:
org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: [52] in the generated java file: [D:\apache-tomcat-8.0.15\work\Catalina\localhost\allRunServer\org\apache\jsp\register_jsp.java] The method getDispatcherType() is undefined for the type HttpServletRequest Stacktrace: org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:199) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:450) org.apache.jasper.compiler.Compiler.compile(Compiler.java:361) org.apache.jasper.compiler.Compiler.compile(Compiler.java:336) org.apache.jasper.compiler.Compiler.compile(Compiler.java:323) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) javax.servlet.http.HttpServlet.service(HttpServlet.java:725) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)思考了一下,不同版本的Tomcat其中的library肯定有所区别,项目自带的jar Package肯定是用于Tomcat6.0的,所以此时,我将Tomcat8的library目录中的servlet-api.jar 覆盖了项目中原有的相同jar包,问题解决。
时间: 2024-10-05 09:37:59