The method getDispatcherType() is undefined for the type HttpServletRequest错误解决方法
使用Eclipse Luna版本,jdk1.7和tomcat8.0开发JAVA EE应用。写一个简单的JSP部署后访问报JSP编译错误,具体错误信息如下:
The method getDispatcherType() is undefined for the type HttpServletRequest
Stacktrace:
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按钮即可。
如果你的项目中报这个错误,可能就是这个原因。
The method getDispatcherType() is undefined for the type HttpServletRequest错误解决方法的更多相关文章
- The method getDispatcherType() is undefined for the type HttpServletRequest
在使用百度的ueditor的时候,老是报错: The method getDispatcherType() is undefined for the type HttpServletRequest 原 ...
- The method getDispatcherType() is undefined for the type HttpServletRequest 升级到tomcat8(转)
配置项目,从tomcat低版本,放到tomcat8时,正常的项目居然报错了: The method getDispatcherType() is undefined for the type Http ...
- 升级到tomcat8遇到The method getDispatcherType() is undefined for the type HttpServletRequest
今天升级到tomcat8,发现原来的项目不能运行了,遇到下面的错误:The method getDispatcherType() is undefined for the type HttpServl ...
- The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory的解决方法
An error occurred at line: [31] in the generated java file: [/data/tmisnt/work/Catalina/localhost/_/ ...
- Undefined symbols for architecture armv7错误解决方法
Undefined symbols for architecture armv7: "_OBJC_CLASS_$_BriefMainModel", referenced from: ...
- The method getServletContext() is undefined for the type HttpServletRequest
request.getServletContext().getRealPath("/") 已经加入了 sun runtime library但是还是提示错误 是因为 写法过时了改成 ...
- The method getTextContent() is undefined for the type Node
eclipse 中 如果加入了 其他了xfire 等其他xml解析包的话,使用org.w3c.dom.Node下的getTextContent()方法会出现The method getTextCont ...
- getTextContent()方法会出现The method getTextContent() is undefined for the type Node 提示
eclipse 中 如果加入了 其他了xfire 等其他xml解析包的话,使用org.w3c.dom.Node下的getTextContent()方法会出现The method getTextCont ...
- dao 接口定义了一个方法,报错 The method xxx is undefined for the type xxx;
转自:https://blog.csdn.net/panshoujia/article/details/78203837 持久层(DAO层)下的一个接口 ,eclipse报了一个The method ...
随机推荐
- ElementUi rules表单验证
ElementUi 表单验证 工作中常用到的JS验证 可以在pattern中书写正则,并且配合elementUI进行表单验证. pattern 属性规定用于验证输入字段的模式.模式指的是正则表达式. ...
- numpy学习笔记 - numpy常用函数、向量化操作及基本数学统计方法
# -*- coding: utf-8 -*-"""主要记录代码,相关说明采用注释形势,供日常总结.查阅使用,不定时更新.Created on Fri Aug 24 19 ...
- size(A,1)
在matlab中,size()用来返回数据序列的行数和列数.size(A,1)返回的是矩阵A所对应的行数.另外,(1)s=size(A), 当只有一个输出参数时,返回一个行向量,该行向量的第一个元素时 ...
- Qt资料大全
简述 发福利了.发福利了.发福利了,重要的事情说三遍... 为了方便更多Qter了解.学习Qt,现将相关资源进行整理,主要内容包括:Qt官网.编码风格.GitHub & Third-Party ...
- 三层登录—c#
学习了三层,有一个登录窗口的小练习.是我们第一次接触三层的初战.如今仅仅是简单的了解了一些,须要学习的还有非常多,以下浅谈自己的理解. 我们说的三层就是分层了显示层.业务逻辑层和数据訪问层.当中显示层 ...
- OC第二课
主要内容:实例变量可见度.方法 一.实例变量可见度 public(共同拥有的):实例变量能够在类的内部和外部使用 protected(受保护的.默认的):实例变量仅仅能在该类及其子类中使用 priva ...
- bzoj1029: [JSOI2007]建筑抢修(堆+贪心)
1029: [JSOI2007]建筑抢修 题目:传送门 题解: 一道以前就做过的水题(找个水题签个到嘛...) 很明显就是一道贪心题,这里我们用一个堆来维护 具体看代码吧,很容易YY所以不讲 代码: ...
- POJ 3668 枚举?
枚举两点,算一下斜率 sort一遍 判个重 输出解 25行 搞定- //By SiriusRen #include <cmath> #include <cstdio> #inc ...
- POJ 3667 线段树+标记
自从某次考试写线段树写挂了以后 这是第一次写线段树,,,,,, 这是一个伤心的故事-- 题意: 思路: 标记 维护从左到右的最大值 从右到左的最大值 区间内的最大值-- 然后就一搞 就出来了 //By ...
- tgtadm和iscsiadm命令的用法
一.tgtadm命令 tgtadm常用于管理三类对象: target:创建new,删除,查看 lun:创建,查看,删除 account:创建用户,绑定,解绑定,删除,查看 语法 ...