2014-05-02 49 views
1

我運行的是獨立的服務器,並試圖建立連接:阿帕奇兔崽子,連接通過WebDAV協議爲localhost

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服務器沒有問題。

+0

你有沒有得到這個工作? – PinoyCoder

回答

0

確保您使用的是正確的URI到WebDAV服務器條目在你堆棧跟蹤它似乎並沒有這樣的情況:

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

您應該使用"http://localhost:8080/server"

+0

身份證確實,當http:// localhost:8080/server是報價的一部分時,論壇報價機制抱怨,因此我改變了它。代碼使用「http:// localhost:8080/server」 – user3151973

2

你的類路徑中是否有jackrabbit-jcr2dav-*.jar庫?

從錯誤報告看,它看起來像RepositoryFactory諮詢的實例不包括org.apache.jackrabbit.jcr2dav.Jcr2davRepositoryFactory - 這是工廠實施,瞭解http:的URL。

(題外話:你,你是缺這個庫,你還需要加入它的依賴 - jackrabbit-spi2dav-*.jar等)