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 ...
随机推荐
- linux VNC-server
[root@kvm-server Packages]# rpm -qpi tigervnc-server-1.8.0-1.el7.x86_64.rpm Name : tigervnc-server V ...
- POJ——T3259 Wormholes
http://poj.org/problem?id=3259 Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 50692 ...
- 洛谷 P2744 [USACO5.3]量取牛奶Milk Measuring
P2744 [USACO5.3]量取牛奶Milk Measuring 题目描述 农夫约翰要量取 Q(1 <= Q <= 20,000)夸脱(夸脱,quarts,容积单位——译者注) 他的最 ...
- java用freemarker实现导出word----包含图片
分为以下三个步骤: 1.先制作word模板 2.将该文档另存为 xml 文件 3.打开xml 文件 将对应的字段替换,比如 4.将xml文件保存成ftl格式的文档 5.相应的代码: package o ...
- [Python]Use Flask-Admin with PostgreSQL
This code recipe gives you an idea of how to use Flask-Admin with postgresql database. from flask im ...
- Android Studio生成apk
1.菜单Build->Generate Signed APK 2.生成android.keystore,能够依据弹框去Create new一个,也可使用命令来生成android.keystore ...
- mysql-计算字段
一.计算字段 存储在数据库表中的数据一般不是应用程序所需要的格式 1.如果想在一个字段中既显示公司名,又显示公司的地址,但这两个信息一般包含在不同的字段中. 2.城市.州和邮编存储在不同的列中,但邮件 ...
- nios DMA使用注意事项
1.对同一个设备的多次DMA读写操作之间如果并行,有可能会导致数据传输错误.可以在程序中对每次DMA操作进行等待.如下: 点击(此处)折叠或打开 void dma_done(void *p) { in ...
- POJ 3666 DP
题意: 思路: dp[i][j] 表示前i + 1个数变成单调且最后一个数是B[j],此时的最小成本 dp[i][j] = min(dp[i – 1][k]) + |A[i] – B[j]| [k = ...
- Spring 注解拦截器使用详解
Spring mvc拦截器 平时用到的拦截器通常都是xml的配置方式.今天就特地研究了一下注解方式的拦截器. 配置Spring环境这里就不做详细介绍.本文主要介绍在Spring下,基于注解方式的拦截器 ...