tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Crowther <peter.crowt...@melandra.com>
Subject Re: ClassCastException in tomcat 6
Date Tue, 05 Jan 2010 07:56:09 GMT
2010/1/5 test123456 <sajith.pc@thinkcoretech.com>

> 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.

- Peter

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message