views:

117

answers:

1

Hi,

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

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?

A: 

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.

Pascal Thivent
Thanks for the answer, but that wouldn't work for our case because by having two profile, we need two releases and I wanted only one.
Javabeginner
@Javabeginner I don't see how manually deleting/adding files is better... What are you looking for *exactly*? What are your constraints? What are your requirements? Adding details usually help to get answers matching them.
Pascal Thivent
Sorry for the ambiguity, to solve the problem, the I think it require a way to make sure Tomcat 6 pick up only one el-api.jar not both of them. The constraint will be:- No change to Tomcat 6- One releases- The solution can be continuously integrated in the build
Javabeginner
@Javabeginner isn't the "other" el-api.jar bundled inside the Tomcat 6 lib directory? I'm afraid the right way to handle this is to not package it in your war is it's already provided.
Pascal Thivent
Sorry, that "other" el-api.jar is required by other parts of the build. so the el-api.jar needed to be there incase someone wanted to use other application server instead of Tomcat6. I am thinking that if I change the name of the "other" el-api.jar, would that solve the problem?
Javabeginner
@Javabeginner Which is why I believe you'll *have to* create two versions of your WAR. And no, renaming it won't solve anything.
Pascal Thivent