关于dependency的scope
provided的含义: whatever version you specify is used at compile time and for testing. At runtime it is assumed to be provided by your runtime container, e.g. Jetty.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
javax.servlet.ServletException: java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/jasper/servlet/JasperLoader) previously initiated loading for a different type with name “javax/servlet/http/HttpServletRequest”
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:275)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
解决:添加<scope>provided</scope>
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
解决:添加<scope>provided</scope>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>