加载程序约束冲突
对于一个项目,我遇到了两次具有相同.jar(对于我的情况,el-api.jar v2.1)的问题,因此,当我尝试使用Tomcat 6运行我的项目时,会出现以下错误堆栈。
WARNING: Unexpected error forwarding to login page
javax.servlet.ServletException: 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/login_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 javax/el/ExpressionFactory used in the signature
at java.lang.Thread.run(Thread.java:619)
Caused by: 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/login_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 javax/el/ExpressionFactory used in the signature
我找到了 http://blog.springsource.com/2008/10/20/understanding-the-osgi-uses-directive/
但这没有用,因为解决方案影响了我项目的太多部分。
我无法对Tomcat进行任何更改,并且该项目将被许多其他用户使用。
目前的解决方法是在每次我们进行构建并使用Tomcat6时.jar删除el-api。然后,我们需要将.jar放回去,因为这是其他东西所要求的。
我用了 Maven 2 和 Maven 3 来构建。(顺便说一句,有谁知道在Jruby上使用Maven3吗?
任何人都可以帮助我解决这个问题吗?