The following exception was found when debugging Spring MVC:
Java.lang.ClassCastException:org.springframework.web.servlet.DispatcherServlet cannot is cast to Javax.servlet.Servlet
The problem is with Servlet-api.jar, when Tomcat deploys the SPRINGMVC project without this package, and when you build a project with Maven, you don't recognize classes like httpservletrequest if you don't reference that dependency
The workaround is to include the attribute scope when Maven references a servlet dependency <scope>provided</scope>
If you do not add an attribute range <scope>provided</scope> when referencing javax.servlet.jsp dependencies, you will also throw the following exception:
Org.apache.jasper.JasperException:Unable to read TLD "Meta-inf/c.tld" from JAR file "file:/e:/chenzehe/mvnrepo/javax/ Servlet/jstl/1.2/jstl-1.2.jar ": org.apache.jasper.JasperException:Failed to load or instantiate Taglibraryvalidator Class:org.apache.taglibs.standard.tlv.JstlCoreTLV
MAVEN builds a Web project, cannot is cast to Javax.servlet.Servlet