Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (1.4k points)

JCR API 2.0的Jackrabbit权限问题

我是Jackrabbit的新手,尝试创建一个节点并将其保存在会话中。我收到以下权限问题:

javax.jcr.RepositoryException: Forbidden
    at org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConverter.java:113)
    at org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConverter.java:49)
    at org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.start(RepositoryServiceImpl.java:457)
    at org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.access$200(RepositoryServiceImpl.java:399)
    at org.apache.jackrabbit.spi2davex.RepositoryServiceImpl.submit(RepositoryServiceImpl.java:304)
    at org.apache.jackrabbit.jcr2spi.WorkspaceManager$OperationVisitorImpl.execute(WorkspaceManager.java:830)
    at org.apache.jackrabbit.jcr2spi.WorkspaceManager$OperationVisitorImpl.access$500(WorkspaceManager.java:797)
    at org.apache.jackrabbit.jcr2spi.WorkspaceManager.execute(WorkspaceManager.java:594)
    at org.apache.jackrabbit.jcr2spi.state.SessionItemStateManager.save(SessionItemStateManager.java:139)
    at org.apache.jackrabbit.jcr2spi.ItemImpl.save(ItemImpl.java:246)
    at org.apache.jackrabbit.jcr2spi.SessionImpl.save(SessionImpl.java:328)
    at com.junhao.jcrmagic.JCRMagic.main(JCRMagic.java:27)
Caused by: org.apache.jackrabbit.webdav.DavException: Forbidden
    at org.apache.jackrabbit.webdav.client.methods.DavMethodBase.getResponseException(DavMethodBase.java:172)
    at org.apache.jackrabbit.webdav.client.methods.DavMethodBase.checkSuccess(DavMethodBase.java:181)
    at org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.start(RepositoryServiceImpl.java:453)
    ... 9 more

我正在使用的jar文件是jackrabbit-standalone-2.20.2.jar,这是我的代码:

String url = "http://localhost:8080/server";

Repository repository = JcrUtils.getRepository(url);
SimpleCredentials creds = new SimpleCredentials("admin","admin".toCharArray());
javax.jcr.Session  jcrSession = repository.login(creds, "default");

Node root=jcrSession.getRootNode();
Node adobe = root.addNode("helloworld");

jcrSession.save();

我可以知道是什么引起了该问题,在哪里可以解决权限问题?

提前致谢!


这个人很懒,什么也没留下...
Welcome To Ask or Share your Answers For Others

Please log in or register to reply this article.

OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...