Hi everyone, I'm a newbie jackrabbit user who has a problem getting the 
jackrabbit repository instance and creating an user.

The repository is deployed and running correctly in Tomcat 6.0. In my own 
Servlet I get a local repository instance to create an user this way, using the 
RepositoryAccessServlet class which obtains the repository by JNDI:

ServletContext ctx = getServletContext();
RepositoryAccessServlet ras = RepositoryAccessServlet.getInstance(ctx);
Repository repositorio = ras.getRepository();

To create the user, after log into the repository, I get the UserManager for 
the session. It is necessary to cast the interface Session to SessionImpl class 
because the interface doesn't provide getUserManager method.

Session sesionadmin = repositorio.login(new SimpleCredentials("admin", 
"admin".toCharArray()));
umanager = ((SessionImpl) sesionadmin).getUserManager();
umanager.createUser(login, password);
sesionadmin.save();

There's no problem at this point. However, if I try to access the repository 
from another Java project, to do the same operation, I need to get the 
repository by RMI because I haven't any ServletContext.

Repository repositorio = new URLRemoteRepository(url)

Logged in the repository a ClassCastException is thrown when the line umanager 
= ((SessionImpl) sesionadmin).getUserManager(); is reached, because 
sessionadmin is an instance of ClientXASession and cannot be cast to 
SessionImpl.

¿There's another way to create an user following the jackrabbit API interfaces 
and not the Impl classes? If it's not possible, ¿how can access the repository 
in a local way from a Java class in a different project not a Servlet?

Thanks for your time.
Regards,
Jesús


________________________________
Este correo electrónico y, en su caso, cualquier fichero anexo al mismo, 
contiene información de carácter confidencial exclusivamente dirigida a su 
destinatario o destinatarios. Si no es vd. el destinatario indicado, queda 
notificado que la lectura, utilización, divulgación y/o copia sin autorización 
está prohibida en virtud de la legislación vigente. En el caso de haber 
recibido este correo electrónico por error, se ruega notificar inmediatamente 
esta circunstancia mediante reenvío a la dirección electrónica del remitente.
Evite imprimir este mensaje si no es estrictamente necesario.

This email and any file attached to it (when applicable) contain(s) 
confidential information that is exclusively addressed to its recipient(s). If 
you are not the indicated recipient, you are informed that reading, using, 
disseminating and/or copying it without authorisation is forbidden in 
accordance with the legislation in effect. If you have received this email by 
mistake, please immediately notify the sender of the situation by resending it 
to their email address.
Avoid printing this message if it is not absolutely necessary.

Reply via email to