April 14, 2020
Estimated Post Reading Time ~

Creating an AEM System User for AEM 6.1

In AEM 6.1, you must create an AEM System User to successfully get a session using code such as:

Map<String, Object> param = new HashMap<String, Object>();
param.put(ResourceResolverFactory.SUBSERVICE, "datawrite");
ResourceResolver resolver = null;

try {
//Invoke the adaptTo method to create a Session used to create a QueryManager
resolver = resolverFactory.getServiceResourceResolver(param);
session = resolver.adaptTo(Session.class);


Note - see this article:
Querying Adobe Experience Manager 6 data using the Sling getServiceResourceResolver method

This code will not work in AEM 6.1 using a standard user,

Note: All AEM 6.x HelpX Articles will be updated soon to use a System user to obtain a Session object from within an OSGi bundle.

To create a system user, perform these tasks:
Open http://localhost:4502/crx/explorer/index.jsp
Login as admin
Click User Administration
Click Create System User
Set the UserId
Click Save
Once created, you can extend permissions like a normal user using the AEM ACL functionality.


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.