resourceResolver.commit() , works on Author server , throws "Access denied" on Publish server | Community
Skip to main content
Level 4
July 31, 2018
Solved

resourceResolver.commit() , works on Author server , throws "Access denied" on Publish server

  • July 31, 2018
  • 12 replies
  • 7349 views

Hi All,

I have a Java component bean which creates a child resource and then calls resourceResolver.commit().

It is working fine on the 6.3 Author server.

But on the 6.3 Publish server it is throwing the following exception:-

org.apache.sling.api.resource.PersistenceException: Unable to commit changes to session.

Caused by: org.apache.jackrabbit.oak.api.CommitFailedException: OakAccess0000: Access denied

    at org.apache.jackrabbit.oak.security.authorization.permission.PermissionValidator.checkPermissions(PermissionValidator.java:210) [org.apache.jackrabbit.oak-core:1.8.2]

Does anyone know how I can investigate / resolve this?

Thank you for your time.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by RobertBailey1

THANK YOU ALL!!     

Got there eventually using the steps below to create a System User , and then "map" System User with OSGi bundle :-

1.1.  Goto http://localhost:4542/crx/explorer/index.jsp

1.2.  Login as admin

1.3.  Click "User Administration"

1.4.  Click "Create SYSTEM User"

1.5.  Input UserID  (for example "content-writer")

1.6.  Click green tick to create System User

Repeat above process for Publish server (http://localhost:4543/crx/explorer/index.jsp)

2.1.  Goto http://localhost:4542/system/console/configMgr

2.2.  Search for "Apache Sling Service User Mapper Service"

2.3.  Click icon to "Edit the configuration values"

2.4.  Click plus ('+') button to add Service Mappings

2.5.  Input new Service Mappings  (for example "org.apache.sling.models.impl=content-writer"  or  "org.apache.sling.models.impl:content-writer=content-writer")

Repeat above process for Publish server (http://localhost:4543/system/console/configMgr)

After completing above steps , it should be possible to getServiceResourceResolver() using the following Java code :-

    final Map<String, Object> param = new HashMap<>();

    param.put(ResourceResolverFactory.SUBSERVICE, "content-writer");

    final ResourceResolver rr = resourceResolverFactory.getServiceResourceResolver(param);

12 replies

RobertBailey1AuthorAccepted solution
Level 4
August 1, 2018

THANK YOU ALL!!     

Got there eventually using the steps below to create a System User , and then "map" System User with OSGi bundle :-

1.1.  Goto http://localhost:4542/crx/explorer/index.jsp

1.2.  Login as admin

1.3.  Click "User Administration"

1.4.  Click "Create SYSTEM User"

1.5.  Input UserID  (for example "content-writer")

1.6.  Click green tick to create System User

Repeat above process for Publish server (http://localhost:4543/crx/explorer/index.jsp)

2.1.  Goto http://localhost:4542/system/console/configMgr

2.2.  Search for "Apache Sling Service User Mapper Service"

2.3.  Click icon to "Edit the configuration values"

2.4.  Click plus ('+') button to add Service Mappings

2.5.  Input new Service Mappings  (for example "org.apache.sling.models.impl=content-writer"  or  "org.apache.sling.models.impl:content-writer=content-writer")

Repeat above process for Publish server (http://localhost:4543/system/console/configMgr)

After completing above steps , it should be possible to getServiceResourceResolver() using the following Java code :-

    final Map<String, Object> param = new HashMap<>();

    param.put(ResourceResolverFactory.SUBSERVICE, "content-writer");

    final ResourceResolver rr = resourceResolverFactory.getServiceResourceResolver(param);

smacdonald2008
Level 10
August 1, 2018

That is great that you got it working. I made a video too to show this in action for community members in the future having issues.