-----Original Message-----
From: Mark Thomas [mailto:ma...@apache.org] 
Sent: Wednesday, 8 August 2012 7:44 p.m.
To: Tomcat Users List
Subject: RE: ClassCastException org.apache.jasper.runtime.ELContextImpl cannot 
be cast to org.apache.jasper.el.ELContextImpl

>>Dale Ogilvie <dale_ogil...@trimble.com> wrote:
>>So you are saying that Tomcat should not be responsible for preventing
>>app1 from unintentionally loading a class from 
>>app2/WEB-INF/lib/[jetty-jsp-el].jar?

>No I am not saying that. The reason you see the exception is because Tomcat 
>(well, with the help of the JVM) prevents a class loaded from one application 
>being visible to another application.

Thanks for your help Mark. I think your understanding doesn't match what is 
being reported. I'll lay it out as I see it, for your consideration:

App1 *does not have* the jetty EL implementation class 
org.apache.jasper.runtime.ELContextImpl anywhere in its classloader tree
App2 *has* the jetty EL implementation EL class 
org.apache.jasper.runtime.ELContextImpl in WEB-INF/lib

When app1 is accessed and an EL expression is encountered in a jsp this error 
results:

ClassCastException org.apache.jasper.runtime.ELContextImpl cannot be cast to 
org.apache.jasper.el.ELContextImpl

That says to me that app1 already has an instance of 
org.apache.jasper.runtime.ELContextImpl which it is trying to cast to the 
tomcat version.  So your statement that "Tomcat prevents a class loaded in app2 
from being visible in app1" seems to be false. App1 according to the error 
message has an instance of org.apache.jasper.runtime.ELContextImpl from app2, 
and it can't be cast to the expected class.

Or am I reading this error message incorrectly?

1. org.apache.jasper.runtime.ELContextImpl is from app2
2. org.apache.jasper.el.ELContextImpl is the normal tomcat class expected in 
app1
3. The error message from app1 is ClassCastException 
org.apache.jasper.runtime.ELContextImpl cannot be cast to 
org.apache.jasper.el.ELContextImpl

Dale

Reply via email to