With an AEM 6.1 environment, I am trying to avoid the deprecated method getAdministrativeResourceResolver
for getting the resource resolver in a java class.
I created system users and used existing system users that fit the right criteria (rep:authorizableId, jcr:uuid, rep:principalName properties populated and jcr:primaryType property being rep:SystemUser)
I configured the Apache Sling Service User Mapping Service
to have the service mapping org...:modifyJCR=oauthservice
(or corresponding user I tried)
The code accessing the getServiceResourceResolver method:
BundleContext context = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
ServiceReference ref = context.getServiceReference(ResourceResolverFactory.class.getName());
resolverFactory = (ResourceResolverFactory) context.getService(ref);
Map<String, Object> param = new HashMap<String, Object>();
param.put(ResourceResolverFactory.SUBSERVICE, "modifyJCR");
resourceResolver = resolverFactory.getServiceResourceResolver(param);
However, I'm still getting this error from my code:
Cannot derive user name for bundle org... [491] and sub service modifyJCR
Has anyone else still run into this error after making/using system users along with configuring the Service User Mapping Service?
Does the system user have to be impersonated by the user invoking the code? The java class is invoked via ecma script called by a workflow and I am logged in as admin. I have tried adding the administrators group as impersonators for multiple users but received an error.