-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark,

On 8/10/12 5:06 AM, Mark Thomas wrote:
> On 10/08/2012 04:57, Dale Ogilvie wrote:
>> -----Original Message----- From: Mark Thomas
>> [mailto:ma...@apache.org] Sent: Thursday, 9 August 2012 8:22
>> 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:
>>>> 
>>>> 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.
>> 
>>> Does that cast succeed? No. Why? Because the class isn't
>>> visible to app1.
>> 
>> Thanks again for your explanations here Mark. Apologies if you
>> thought I was calling your credentials into question. Nothing of
>> any sort entered into my mind.
>> 
>> Trying not to be annoying, just to gain clarity. I'll rephrase
>> your comment above for clarity of what I believe you are saying.
>> 
>> "Does that cast of the org.apache.jasper.runtime.ELContextImpl
>> instance succeed? No. Why? Because the
>> org.apache.jasper.runtime.ELContextImpl class isn't visible to
>> app1."
>> 
>> If app1 has an instance of
>> org.apache.jasper.runtime.ELContextImpl (provided by app2) whose
>> class it knows nothing about, shouldn't the exception be:
>> 
>> ClassNotFoundException org.apache.jasper.runtime.ELContextImpl
>> 
>> NOT
>> 
>> ClassCastException org.apache.jasper.runtime.ELContextImpl cannot
>> be cast to org.apache.jasper.el.ELContextImpl
>> 
>> The latter error does not tell me that the class
>> org.apache.jasper.runtime.ELContextImpl isn't visible to app1.
> 
> It will depend exactly what is going on but since it is a cast
> that fails, ClassCastException doesn't seem to be unreasonable.
> There may be a root cause that provides more detail. The full
> exception should be in the logs.

Actually, I would have expected the ClassCastException because the JVM
is not trying to load a class at this point: the Class was loaded long
before through some unrelated mechanism. When this failure occurs, the
Class has been loaded and an object has already been created: the JVM
is just checking a cast which (of course) fails.

Dave, if this is reproducable, you ought to be able to catch it with a
debugger and go and look at all the interesting details such as which
ClassLoader loaded which class, what the exact type (Class +
ClassLoader) of the object in question is, and exactly what type
(Class + ClassLoader) is being used for the cast.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlAlHVcACgkQ9CaO5/Lv0PDdCQCgh08W+lt8fppRiEpahGXF1pRY
MAsAn2YpMDkFjJ4Ll/EKiOuOEoaz2UEK
=eQxK
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to