Loader Constraint Violation

  • Post author:
  • Post category:Java / Tools

If you are using Ivy to manage Spring dependencies and trying to deploy to Tomcat 7, you might have encountered the error.

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, 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 javax/el/ExpressionFactory used in the signature

This seems to be a conflict between the javax.el classes. To fix it, just remove javax.el from your Ivy Spring dependency.

		<dependency org="org.springframework" name="org.springframework.web.servlet" rev="3.0.5.RELEASE">
			<!-- Fix for java.lang.LinkageError -->
			<exclude name="com.springsource.javax.el" />