我遇到了一個項目有兩個相同的.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時,都要manuelly刪除el-api.jar。然後我們需要把.jar放回原來的名稱。
我使用Maven 2和Maven 3來構建。 (順便說一句,有沒有人知道在Jruby上使用Maven3?)
任何人都可以幫我解決這個問題嗎?
對不起,爲了解決這個問題,我認爲它需要一種方法來確保Tomcat 6只接收一個el-api.jar而不是兩個。 約束將是: - \t沒有變化到Tomcat 6 - \t一個版本 - \t該解決方案可連續集成構建的答案 – Javabeginner 2010-09-21 15:35:46