0

此代码片段:

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 存储库?

4

2 回答 2

1

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

是 org.apache.sling.jcr.davex 包为 Jackrabbit DavEx 协议提供了这个桥梁。

于 2013-10-24T07:49:47.203 回答
0
Repository repository = JcrUtils.getRepository("http://localhost:8080");
Session session = repository.login(new SimpleCredentials("admin", "admin".toCharArray()), "crx.default");
于 2015-08-13T07:51:38.410 回答