jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From director <ujjwal_ri...@yahoo.com>
Subject Re: problem regarding user creation in jack rabbit
Date Tue, 07 Aug 2012 21:15:13 GMT
Thank You jukka Zitting for replying to my thread.  



-------- As you suggested me to use local instance, I have written java code
like this to get a local repository instance ---------

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 

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 will post the code
to the jackrabbit community very shortly. 

Could you please tell  me how can we get a jackrabbit session from the
jcr2spi session. 

Thank you in advance. 









--
View this message in context: http://jackrabbit.510166.n4.nabble.com/problem-regarding-user-creation-in-jack-rabbit-tp4656124p4656261.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Mime
View raw message