文章目录
-
- 报错信息
- 解决方法
报错信息
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.getDispatcherType()Ljavax/servlet/DispatcherType;
org.springframework.web.servlet.FrameworkServlet.logResult(FrameworkServlet.java:1087)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1022)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.9 logs.
解决方法
整理SpringMVC 笔记的时候,运行一个小Demo给我报的错,修改Tomcat 的版本就可以解决。
配置Tomcat 的时候,使用8版本的不会出现这个问题。使用6版本会出现
另外附上我的 pom 依赖
<dependencies>
<!-- SpringMVC -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.3.1</version>
</dependency>
<!-- 日志 -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency>
<!-- ServletAPI -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>compile</scope>
</dependency>
<!-- Spring5和Thymeleaf整合包 -->
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring5</artifactId>
<version>3.0.12.RELEASE</version>
</dependency>
</dependencies>