Apache Jackrabbit,通过WebDAV协议连接到localhost

时间:2014-05-02 21:58:23

标签: java jackrabbit jcr

我正在运行独立服务器并尝试建立连接:

 try {
       Repository repository = JcrUtils.getRepository("http://localhost:8080/server/");

     } catch (RepositoryException ex) {
       Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
     }

如:http://wiki.apache.org/jackrabbit/RemoteAccess

中所述

然而,我得到了:

javax.jcr.RepositoryException: Unable to access a repository with the following settings: org.apache.jackrabbit.repository.uri: "the locla host"
The following RepositoryFactory classes were consulted:
    org.apache.jackrabbit.core.RepositoryFactoryImpl: declined
org.apache.jackrabbit.commons.JndiRepositoryFactory: declined
Perhaps the repository you are trying to access is not available at the moment.

使用webrowser浏览jackrabbit服务器没问题。

2 个答案:

答案 0 :(得分:2)

您的班级路径中是否有jackrabbit-jcr2dav-*.jar库?

从错误报告中看来,咨询的RepositoryFactory个实例似乎不包含org.apache.jackrabbit.jcr2dav.Jcr2davRepositoryFactory - 这是了解http:网址的工厂实施。

(除了:你错过了这个库,你还需要添加它的依赖项 - jackrabbit-spi2dav-*.jar等)。

答案 1 :(得分:0)

确保使用正确的URI到WebDAV服务器条目,就像在堆栈跟踪中一样,似乎并非如此:

Unable to access a repository with the following settings: org.apache.jackrabbit.repository.uri: "the locla host"

您应该使用"http://localhost:8080/server"