Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Unable to connect to CRX Server using JCR/JackRabbit


Level 1

I am trying to access a CRX server over the internet using JcrUtils.getRepository method in JCR/JackRabbit and receiving the following error:

javax.jcr.RepositoryException: Unable to access a repository with the following settings:
  org.apache.jackrabbit.repository.uri: http://<<Server Name>>/crx/server
The following RepositoryFactory classes were consulted:
Perhaps the repository you are trying to access is not available at the moment.
at org.apache.jackrabbit.commons.JcrUtils.getRepository(JcrUtils.java:184)
at org.apache.jackrabbit.commons.JcrUtils.getRepository(JcrUtils.java:223)
at ReadContentRepositary.main(ReadContentRepositary.java:19)

This is my code:

import javax.jcr.Repository;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
import javax.jcr.Node;
import org.apache.jackrabbit.*;

import org.apache.jackrabbit.commons.JcrUtils;
import org.apache.jackrabbit.core.TransientRepository;

public class ReadContentRepositary {

public static void main(String[] args) {
// TODO Auto-generated method stub

try { 
//Create a connection to the CQ repository running on local host
Repository repository = JcrUtils.getRepository("http://<<Server Name>>/crx/server");

//Create a Session
javax.jcr.Session session = repository.login( new SimpleCredentials("admin", "admin".toCharArray()));

//Create a node that represents the root node
Node root = session.getRootNode();
System.out.println("Root Node Value is " + root.getIndex());

// Save the session changes and log out
catch(Exception e){


2 Replies


Level 3


What version of AEM are you using?

Did you check the WebDav bundles on the target AEM server? Remote access is dependent on the WebDav configuration. The code seems alright to me, however this is reminiscent of CQ 5.X.

Please check and let me know.

Thank you