Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Programatically access AEM Publish Server from Author AEM6.5


Level 2

We have a requirement in our application where we are building an utility which will only run on AEM author environment. This will search for users by his/her email ID on both author and publish servers. For this we have to connect to publish servers from author environment. I am trying to do it by using the following piece of code on author environment,

final String repoUrl = "http://localhost:4503/crx/server";
final javax.jcr.Repository repository = JcrUtils.getRepository(repoUrl);
final Session session = repository.login(new javax.jcr.SimpleCredentials("admin", "admin".toCharArray()), "crx.default"); 

But I am getting error while doing JcrUtils.getRepository(repoUrl) as below,

Unable to access a repository with the following settings: org.apache.jackrabbit.repository.uri: http://localhost:4503/crx/server The following RepositoryFactory classes were consulted: Perhaps the repository you are trying to access is not available at the moment..

Any help is highly appreciated

1 Reply


Community Advisor

In order to get the user details , you shouldn't not create any session or respository object for publish. That would result in impacting end users.


Firstly , this requirement is little strange. But to solve the problem, simplest way that i would think is to hit a querybuilder.json api to fetch user data from /home/users. This requires hardly http connection in your java code. No other objects.

Example URL -