tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: ClassCastException in tomcat 6
Date Tue, 05 Jan 2010 21:28:43 GMT
Hash: SHA1


On 1/5/2010 2:56 AM, Peter Crowther wrote:
> 2010/1/5 test123456 <>
>> I put the jackrabbit.war file into the webapps.
>> I have a new test project which will access the jackrabbit.war through the
>> JNDI lookup.
>> In server.xml i have a global jndi resource.
>> and the tomcat lib directory contain all the required jar files.
>> In the test project , i am able to get the JNDI resource and lookup()
>> returns a org.apache.jackrabbit.core.jndi.BindableRepository object
>> When i try to cat this to org.apache.jackrabbit.api.jsr283.Repository
>> object
>> , it throws the ClassCastException .
>> I suspect you have the same class defined twice: once in jackrabbit.war,
> once in Tomcat's lib directory.  The version loaded by JNDI will be from
> lib, the version from the webapp will be the one from jackrabbit.war.
> Because they are loaded by different classloaders, they are *different*
> classes and are not castable even though they have the same name.
> If this is the issue: to fix it, ensure no duplicate classes are defined.
> This may require removing a number of jars from the war file.

The easiest thing to do if you need the classes in both Tomcat (for JNDI
binding) and your webapp (so you can use the JNDI resource) is to place
the jackrabbit.jar file into a commons ClassLoader such as
CATALINA_BASE/lib for Tomcat 6.

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message