Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
281 views
in Technique[技术] by (71.8m points)

java - Jackrabbit permission issue with JCR API 2.0

I am new to Jackrabbit and trying create a node and save it in the session. I got the following permission issue:

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

The jar file I am using is jackrabbit-standalone-2.20.2.jar and here's my code:

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();

May I know what could have cause the issue and where can I resolve the permission issue?

Thanks in advance!

question from:https://stackoverflow.com/questions/65651895/jackrabbit-permission-issue-with-jcr-api-2-0

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...