2012-07-27

How to resolve Loader Constraint Violation while running a Spring MVC Project on Tomcat 7

  • Loader Constraint Violation while running a Spring MVC Project on Tomcat 7

  • Error Message
    java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/WEB_002dINF/views/home_jsp, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type avax/el/ExpressionFactory; used in the signature

  • Cause
    Tomcat 7 uses el-api 2.2 and jsp-api 2.2.

  • Solution
    1. Open POM.XML file and Go to Dependencies page
    2. Select jsp-api : 2.1 > Click Properties > Change 2.1 to 2.2
    3. Save and run to check

1 comment: