我是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();
我可以知道是什么引起了该问题,在哪里可以解决权限问题?
提前致谢!
这个人很懒,什么也没留下...