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开发者_如何学JAVA, 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
I have found the 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.
I can't make any changes to the Tomcat as well as the project will be used by many other user.
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.
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?
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.
Then mark the el-api.jar artifact as provided
, if it is.
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.
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.
I got this error attempting to run the Spring (3.0.5) sample mvc-ajax with Tomcat 7.
Tomcat 7 uses el-api 2.2 and jsp-api 2.2. The mvc-ajax pom file specifies jsp-api 2.1, which also contains the classes in el-api.
To get this running I commented out jsp-api 2.1 from the pom. This allowed Tomcat to use its own (more recent) version.
精彩评论