“The method getDispatcherType() is undefined for the type HttpServletRequest”
2017-07-27 10:28
190 查看
正常运行的项目,加了些功能后,突然遇到了 个错误:
按照错误信息中的提示The method getDispatcherType() is undefined for the type HttpServletRequest去网上查找,说是servlet-api的问题。因为项目里用的servlet-api和tomcat8下面的冲突了。
原来项目里用的是这个版本的:
pom.xml:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
....
注释掉这句后,直接通过项目的build path引入了Tomcat8的lib下面的servlet-api.jar,项目确实正常了。
真是让人莫名其妙啊!之前也一直用的是Tomcat8,这个项目也是正常运行的。不知道哪里触动了这个异常的开关?
查找了maven库http://mvnrepository.com,输入servlet-api后才知道,原来这个jar包早就过时了,上面有提示:
最终解决办法:
将pom.xml 中原来的依赖改为:
[html] view
plain copy
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
重新发布项目后正常运行。
org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: [63] in the generated java file: [C:\Users\zhangvalue\.IntelliJIdea2016.1\system\tomcat\Unnamed_AHelloSpringMvcDemo_2\work\Catalina\localhost\ROOT\org\apache\jsp\index_jsp.java] 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:585) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:363) 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:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
按照错误信息中的提示The method getDispatcherType() is undefined for the type HttpServletRequest去网上查找,说是servlet-api的问题。因为项目里用的servlet-api和tomcat8下面的冲突了。
原来项目里用的是这个版本的:
pom.xml:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
....
注释掉这句后,直接通过项目的build path引入了Tomcat8的lib下面的servlet-api.jar,项目确实正常了。
真是让人莫名其妙啊!之前也一直用的是Tomcat8,这个项目也是正常运行的。不知道哪里触动了这个异常的开关?
查找了maven库http://mvnrepository.com,输入servlet-api后才知道,原来这个jar包早就过时了,上面有提示:
最终解决办法:
将pom.xml 中原来的依赖改为:
[html] view
plain copy
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
重新发布项目后正常运行。
相关文章推荐
- The method getDispatcherType() is undefined for the type HttpServletRequest的解决方法
- 部署Tomcat8遇到的 “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(转)
- The method getDispatcherType() is undefined for the type HttpServletRequest 升级到tomcat8
- 问题“The method getDispatcherType() is undefined for the type HttpServletRequest”
- Web crash: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
- Java 被访问时报 the method getDispatcherType() is undefined for the type HttpServletRequest
- Spring找不到方法: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
- 升级到tomcat8遇到The method getDispatcherType() is undefined for the type HttpServletRequest
- 升级到tomcat8遇到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