jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Morse <rmo...@mdesignz.com>
Subject Classloader Issue?
Date Sat, 11 Apr 2009 22:08:23 GMT

I've run into a problem in getting a Session for Jackrabbit.
My environment:
Jackrabbit 1.5.4, JBoss 4.2.3.GA (jdk6), Mac OS x 10.5.6, MySql, Seam  
This is an EAR deployment.

I followed the steps in the Wiki for getting Jackrabbit running (http://wiki.apache.org/jackrabbit/JackrabbitOnJBoss

), and it appears to be working.
I can also connect via WebDav to the repository using Mac's normal  
facilities.  I'm mentioning this only to establish that I think  
JackRabbit is installed and
running correctly.

Further in the Wiki entry, it describes accessing the Repository via  
JNDI, and this is where I run into a snag.  After some trial and  
error, I have the following

jackrabbit-jcr-rmi-1.5.0.jar, jcr-1.0.jar  in $JBOSS_HOME/server/ 
jackrabbit-jca-1.5.4.rar, jackrabbit-server.war, jcr-ds.xml and my  
application EAR in $JBOSS_HOME/server/default/deploy

If I follow the Wiki example exactly, I get:

15:06:01,802 ERROR [STDERR] java.lang.ClassCastException:  
org.apache.jackrabbit.jca.JCARepositoryHandle cannot be cast to  

during the
Repository repo = (Repository) ctx.lookup("java:jcr/local") ;

So, I made the "obvious" choice and changed the type to  

JCARepositoryHandle jrh = (JCARepositoryHandle) ctx.lookup("java:jcr/ 
local") ;

and got this.  This error makes no sense to me.

15:13:36,004 ERROR [STDERR] java.lang.ClassCastException:  
org.apache.jackrabbit.jca.JCARepositoryHandle cannot be cast to  

Here's the original (broken) code that tries to get a Session.  It  
fails with the first exception.
Not sure what I'm missing, but would appreciate any and all comments  
and pointers.   Thanks!

    static public Session getJackrabbitSession() throws  
       Properties env = new Properties();
       env.put(Context.PROVIDER_URL, "jnp://localhost:1099");

          InitialContext ctx = new InitialContext(env);
          Repository repo = (Repository) ctx.lookup("java:jcr/local");
          Credentials cred = new SimpleCredentials("user", new char[]  
{ 'p', 'w', 'd' });
          return repo.login(cred);
       catch (NamingException ex)
       return null;

The human mind is an iterative processor, it never does anything right  
the first time.  What it does well is to make improvements on every  
iteration (deMarco)

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