jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobias Bocanegra <tobias.stras...@gmail.com>
Subject Re: ClassCastException when getting Repository from InitialContext (Sorry if this is a repost)
Date Thu, 25 Aug 2005 15:45:44 GMT
hi Digby,
the problem is, that the classloader that creates the repository uses
another jcr-1.0.jar than the classloader that looks up the repository.

make sure that the jcr-1.0.jar is located in the
$CATALINA_HOME/shared/lib. then all classloaders should use this one.

cheers, tobi

On 8/25/05, lists <lists@digby.net> wrote:
> Hi,
> 
> Another query:
> 
> I've set up Jackrabbit to run in Tomcat 5.5 and have set up the resource
> in server.xml and context.xml. All looks good. I can get the
> BindableRepository back from the context, but I can't cast it to a
> javax.jcr.Repository.
> 
> The weird thing is, if I cast to an object, I can see that is is a
> BindableRepository, I can see that one of the interfaces it implements
> is Repository, i.e.
> 
> InitialContext context = new InitialContext();
> Context environment = (Context) context.lookup("java:comp/env");
> Object repository = (Object) environment.lookup("jcr/repository");
> out.println(repository.getClass().getGenericInterfaces()[0]);
> 
> gives "interface javax.jcr.Repository"
> 
> But
> 
> out.println(repository instanceof javax.jcr.Repository);
> 
> gives false
> 
> And the cast causes a ClassCastException. Can anyone shed any light on
> this? Is it something to do with the BindableRepository having default
> access?
> 
> Many thanks,
> 
> Digby
> 
> 


-- 
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97 
-----------------------------------------------< http://www.day.com >---

Mime
View raw message