1. 程式人生 > >對於loader constraint violation問題的解決方案

對於loader constraint violation問題的解決方案

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
:268) javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

在用maven工程構建web引用的時候引起的包衝突問題,造冊灰姑娘的原因是,我在pom.xml檔案中新增jar包的時候,scope的範圍是compile,只需要將scope的範圍改為provided,如下所示

<dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>3.0-alpha-1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>