The method getDispatcherType() is undefined for the type HttpServletRequest错误解决方法
来源:互联网 发布:网络理财投资 编辑:程序博客网 时间:2024/05/17 20:31
使用Eclipse Luna版本,jdk1.7和tomcat8.0开发JAVA EE应用。写一个简单的JSP部署后访问报JSP编译错误,具体错误信息如下:
The method getDispatcherType() is undefined for the type HttpServletRequestStacktrace: org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:198) 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:570) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:356) 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)
在网上搜了下没找到解决办法,自己分析了一下,其实错误很明显解决方法也很简单。
大家都知道JSP页面会被WEB容器翻译成Servlet,最终会编译成class文件,这个错误的意思是:”HttpServletRequest中找不到getDispatcherType()方法的定义”。
原因是本人在classpath中添加了j2ee.jar包,这个jar包是从老项目中拷贝出来的,属于早期的j2ee规范,HttpServletRequest缺少getDispatcherType()的定义。
解决方案:
1.將j2ee.jar从编译路径中移除。
2.在项目上点击右键->Properties->Java Build Path->Libraries,点击Add Library->Server Runtime,点击Next按钮,点击 Apache Tomcat v8.0, 点击Finish按钮即可。
如果你的项目中报这个错误,可能就是这个原因。
0 0
- The method getDispatcherType() is undefined for the type HttpServletRequest错误解决方法
- The method getDispatcherType() is undefined for the type HttpServletRequest
- the method getDispatcherType() is undefined for the type HttpServletRequest
- jsp The method getDispatcherType() is undefined for the type HttpServletRequest
- The method getDispatcherType() is undefined for the type HttpServletRequest
- The method getDispatcherType() is undefined for the type HttpServletRequest
- The method getDispatcherType() is undefined for the type HttpServletRequest解决办法
- The method getDispatcherType() is undefined for the type HttpServletRequest解决办法
- 问题“The method getDispatcherType() is undefined for the type HttpServletRequest”
- The method getDispatcherType() is undefined for the type HttpServletRequest
- 解决The method getDispatcherType() is undefined for the type HttpServletRequest
- “The method getDispatcherType() is undefined for the type HttpServletRequest”
- The method getDispatcherType() is undefined for the type HttpServletRequest的解决方法
- The method getDispatcherType() is undefined for the type HttpServletRequest 升级到tomcat8
- Spring找不到方法:The method getDispatcherType() is undefined for the type HttpServletRequest
- 升级到tomcat8遇到The method getDispatcherType() is undefined for the type HttpServletRequest
- Java 被访问时报 the method getDispatcherType() is undefined for the type HttpServletRequest
- Web crash:The method getDispatcherType() is undefined for the type HttpServletRequest
- vi编辑工具
- uva 572 Oil Deposits
- 通信系统中为什么要进行调制和解调?调制的分类方法有哪些?
- C++ map<key , value> key值为指针
- 概念模型、数据模型、关系数据模型
- The method getDispatcherType() is undefined for the type HttpServletRequest错误解决方法
- 学习android的第一个程序
- 【已解决】运行Eclipse出错:Failed toload the JNI shared library
- ORACLE数据库的表管理(自学笔记)
- odbcConnectExcel is only usable with 32-bit Windows
- ios中的动画
- 全备份情况下,删除控制文件及恢复
- ubuntu系统文件夹目录说明
- poj 1113