加载器约束违例 [英] loader constraint violation
问题描述
我遇到了对于一个项目使用相同.jar(对于我的情况,el-api.jar v2.1)两次的问题,因此,当我尝试使用Tomcat 6运行我的项目时,出现以下错误堆栈。 / p>
I encountered the problem of having the same .jar (for my case, el-api.jar v2.1)twice for one project, hence, the following error stack when I try to run my project using 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/
但这不是有用的因为解决方案影响了我项目的太多部分。
but that is not useful as the solution effects too many parts of my project.
我无法对Tomcat进行任何更改,项目也将被许多其他用户使用。
I can't make any changes to the Tomcat as well as the project will be used by many other user.
当前的工作是每次我们做一个构建并使用Tomcat6时,手动删除el-api.jar。然后,我们需要把.jar放回到其他东西。
The current work around is to manuelly delete the el-api.jar every time we do a build AND uses Tomcat6. Then we need to put the .jar back as that is requested for other stuff.
我使用Maven 2和Maven 3来构建。 (btw,有没有人知道关于在Jruby上使用Maven3?)
I am used Maven 2 and Maven 3 to build. (btw, did anyone know about use Maven3 on Jruby?)
任何人都可以帮我解决这个问题?
Can anyone help me with the issue?
推荐答案
我遇到了有相同.jar的问题(对于我的case,el-api .jar v2.1)两次为一个项目,因此,当我尝试使用Tomcat 6运行我的项目时,以下错误堆栈。
I encountered the problem of having the same .jar (for my case, el-api.jar v2.1)twice for one project, hence, the following error stack when I try to run my project using Tomcat 6.
然后将el-api.jar工件标记为提供的
。
Then mark the el-api.jar artifact as provided
, if it is.
目前的工作是每次我们做一个构建AND使用Tomcat6 manuelly删除el-api.jar。然后,我们需要把.jar放回到其他东西。
The current work around is to manuelly delete the el-api.jar every time we do a build AND uses Tomcat6. Then we need to put the .jar back as that is requested for other stuff.
一个更好的方法是声明配置文件中的依赖关系,并标记为
(例如在tomcat6配置文件)或不是根据需要。
A much better way to handle this would be to declare the dependency inside profiles and to mark it as provided
(e.g. in a "tomcat6" profile) or not depending on the needs.
这篇关于加载器约束违例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!