jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From director <ujjwal_ri...@yahoo.com>
Subject Some findings
Date Sun, 12 Aug 2012 07:23:48 GMT
Dear JackRabbit users,

I started using JackRabbit just before one and half month. With in this
period, I think, I found something that is useful for all of us. 

**** Never use RMI to connect to the JackRabbit server. Always get the local
server instance before you do something. I started connecting to JackRabbit
with the RMI  and it even didn't perform search operation with the xpath
query.  But the server instance will easily do that.

Currently I am using JackRabbit in my project and I am facing difficulties
in user creation. And this user creation part is very important for my
project. I have done the following things for creating users but some error
arouse:

Repository repository =
JcrUtils.getRepository("http://localhost:8088/server");
String username = "admin";
String password = "admin";
                 
System.out.println(repository);
session = repository.login(new SimpleCredentials(username,
password.toCharArray()));-----up to this line of code is ok as I can get a
session.

But when I use the following code  to get a user manager, it shows the
error.
UserManager um = ((JackrabbitSession)session).getUserManager();


The error is:
Exception in thread "main" java.lang.ClassCastException:
org.apache.jackrabbit.jcr2spi.SessionImpl cannot be cast to
org.apache.jackrabbit.api.JackrabbitSession
        at jack.Repconfautomatic.<init>(Repconfautomatic.java:88)
        at jack.Repconfautomatic.main(Repconfautomatic.java:116)

After getting this error, I printed the class of session that I am receiving
with the above java program by using the following  code:
System.out.println(session.getClass()) and this line prints the session's
class.

To solve this error, I have tried many things. I searched almost all the
links in the internet but I couldn't get any thing to solve this. Yes, there
are some more posts about the same error but there is no solution. I also
tried with the Titus Barik's example from ibm.com to get a repository
instance through jndi but it also has so many problems. 

I am looking forward for any suggestions and ideas to solve this problem.

Thank you in advance.


 



--
View this message in context: http://jackrabbit.510166.n4.nabble.com/Some-findings-tp4656285.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Mime
View raw message