我怎么能从JCR客户端使用sling存储库?

时间:2013-10-23 16:39:24

标签: jcr sling

此代码段:

Repository repository = JcrUtils.getRepository("http://localhost:8080");
Session session = repository.login(new SimpleCredentials("admin",
                    "admin".toCharArray()));

给出以下例外:

javax.jcr.LoginException: Login failed: Unknown workspace 'null'.
    at org.apache.jackrabbit.spi2dav.RepositoryServiceImpl.obtain(RepositoryServiceImpl.java:799)
    at org.apache.jackrabbit.spi2dav.RepositoryServiceImpl.obtain(RepositoryServiceImpl.java:748)
    at org.apache.jackrabbit.spi2davex.RepositoryServiceImpl.obtain(RepositoryServiceImpl.java:309)
    at org.apache.jackrabbit.jcr2spi.RepositoryImpl.login(RepositoryImpl.java:151)
    at org.apache.jackrabbit.commons.AbstractRepository.login(AbstractRepository.java:144)

对抗从源头建立的香草吊索。如果我将, "default"添加到登录调用中,它将变为:

javax.jcr.ItemNotFoundException: Not Found
    at org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConverter.java:100)
    at org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConverter.java:51)
    at org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConverter.java:45)
    at org.apache.jackrabbit.spi2dav.RepositoryServiceImpl.obtain(RepositoryServiceImpl.java:804)
    at org.apache.jackrabbit.spi2dav.RepositoryServiceImpl.obtain(RepositoryServiceImpl.java:748)
    at org.apache.jackrabbit.spi2davex.RepositoryServiceImpl.obtain(RepositoryServiceImpl.java:309)
    at org.apache.jackrabbit.jcr2spi.RepositoryImpl.login(RepositoryImpl.java:151)

我应该如何使用JCR客户端的sling存储库?

2 个答案:

答案 0 :(得分:1)

假设您想通过DavEx远程访问存储库(根据http://wiki.apache.org/jackrabbit/RemoteAccess),默认网址为http://localhost:8080/server

这是为Jackrabbit DavEx协议提供此桥梁的org.apache.sling.jcr.davex捆绑包。

答案 1 :(得分:0)

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'username';
$db['default']['password'] = 'password';
$db['default']['database'] = 'dbname';
$db['default']['dbdriver'] = 'mysqli';