jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Malzer Ferdinand OSP sIT <Ferdinand.Mal...@s-itsolutions.at>
Subject AW: How to create users using jackrabbit?
Date Tue, 04 Mar 2014 11:19:09 GMT
hello,

i use this code -sequence:

        Session session = null;
        try {
            //login to default workspace
            session = rep.login(new SimpleCredentials(userName,pwd));
            //retrieve user manager
            JackrabbitSession js = (JackrabbitSession) session;
            UserManager userMgr = js.getUserManager();

            //create the user
            org.apache.jackrabbit.api.security.user.User user = userMgr.createUser(UserId,
password);
	...

regards.

	
-----Ursprüngliche Nachricht-----
Von: AshokBS [mailto:asiddaiah@altimetrik.com] 
Gesendet: Dienstag, 04. März 2014 11:09
An: users@jackrabbit.apache.org
Betreff: How to create users using jackrabbit? [phishing][bayes][heur]
Wichtigkeit: Niedrig

Hi, I have gone through many links and was not able to create users via
jackrabbit. Right now i am using jackrabbit-standalone-2.6.5.jar.

I have tried the below steps and was not able to create users until now ,
please help me what am i missing here:

Line1: Repository repository =
JcrUtils.getRepository("http://localhost:9090/server/"); 
Line2: Session session = repository.login(new SimpleCredentials("admin",
"admin".toCharArray()));
		
Line3: UserManager um = ((JackrabbitSession) session).getUserManager(); 
Line4: User user = um.createUser("john", "doe");

It throws an error at line no: 3.

The error is: java.lang.ClassCastException:
org.apache.jackrabbit.jcr2spi.SessionImpl cannot be cast to
org.apache.jackrabbit.api.JackrabbitSession at
com.sample.SampleJackrabbit.main(SampleJackrabbit.java:23)

Can someone provide me the steps i.e. best way to create user
programmatically? 





--
View this message in context: http://jackrabbit.510166.n4.nabble.com/How-to-create-users-using-jackrabbit-tp4660409.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Mime
View raw message