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..
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.