You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Brent Vaughn <Va...@iecokc.com> on 2016/03/30 21:00:05 UTC

Need help logging into Jackrabbit programmatically

I am new to Jackrabbit.  I downloaded the Standalone Server jar.  It is currently up and running.  From an browser I enter this URL http://ieca124.lsb-okc.com:8080/repository/default and login with the admin user name and default password.  It seems to work fine.  It shows an empty default repository.

However, when I try to login programmatically using this code

Repository repository = JcrUtils.getRepository("http://ieca124.lsb-okc.com:8080/repository");
Session session = repository.login(new SimpleCredentials("admin", "admin".toCharArray()), "default");


I get an error trying to run the login method.  Could someone show me what I am doing wrong?  I haven't change the repository.xml or any other file.  I am just using the defaults from when you run "java -jar jackrabbit-standalone-2.12.1.jar".   Here is the stacktrace I get

log4j:WARN No appenders could be found for logger (org.apache.jackrabbit.jcr2spi.Jcr2spiRepositoryFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" javax.jcr.LoginException: Login failed: Unknown workspace 'default'.
       at org.apache.jackrabbit.spi2dav.RepositoryServiceImpl.obtain(RepositoryServiceImpl.java:804)
       at org.apache.jackrabbit.spi2dav.RepositoryServiceImpl.obtain(RepositoryServiceImpl.java:753)
       at org.apache.jackrabbit.spi2davex.RepositoryServiceImpl.obtain(RepositoryServiceImpl.java:307)
       at org.apache.jackrabbit.jcr2spi.RepositoryImpl.login(RepositoryImpl.java:151)
       at com.iecokc.sandbox.SecondHop.main(SecondHop.java:19)



Re: Need help logging into Jackrabbit programmatically

Posted by Clay Ferguson <wc...@gmail.com>.
Leave off the "default" parameter and just call the login method that has
only the credential object as the parameter.

Best regards,
Clay Ferguson
wclayf@gmail.com


On Wed, Mar 30, 2016 at 2:00 PM, Brent Vaughn <Va...@iecokc.com> wrote:

> I am new to Jackrabbit.  I downloaded the Standalone Server jar.  It is
> currently up and running.  From an browser I enter this URL
> http://ieca124.lsb-okc.com:8080/repository/default and login with the
> admin user name and default password.  It seems to work fine.  It shows an
> empty default repository.
>
> However, when I try to login programmatically using this code
>
> Repository repository = JcrUtils.getRepository("
> http://ieca124.lsb-okc.com:8080/repository");
> Session session = repository.login(new SimpleCredentials("admin",
> "admin".toCharArray()), "default");
>
>
> I get an error trying to run the login method.  Could someone show me what
> I am doing wrong?  I haven't change the repository.xml or any other file.
> I am just using the defaults from when you run "java -jar
> jackrabbit-standalone-2.12.1.jar".   Here is the stacktrace I get
>
> log4j:WARN No appenders could be found for logger
> (org.apache.jackrabbit.jcr2spi.Jcr2spiRepositoryFactory).
> log4j:WARN Please initialize the log4j system properly.
> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
> more info.
> Exception in thread "main" javax.jcr.LoginException: Login failed: Unknown
> workspace 'default'.
>        at
> org.apache.jackrabbit.spi2dav.RepositoryServiceImpl.obtain(RepositoryServiceImpl.java:804)
>        at
> org.apache.jackrabbit.spi2dav.RepositoryServiceImpl.obtain(RepositoryServiceImpl.java:753)
>        at
> org.apache.jackrabbit.spi2davex.RepositoryServiceImpl.obtain(RepositoryServiceImpl.java:307)
>        at
> org.apache.jackrabbit.jcr2spi.RepositoryImpl.login(RepositoryImpl.java:151)
>        at com.iecokc.sandbox.SecondHop.main(SecondHop.java:19)
>
>
>