Expand my Community achievements bar.

Connecting to AEM 6.1 from Java

Avatar

Level 2

After upgrading to 6.1, a standalone Java utility program we use stopped working.

We have updated the utility following the directions here: https://helpx.adobe.com/experience-manager/using/programmatically-accessing-cq-content-using.html

We are building it with jackrabbit-standalone 2.11.3. Should we be using an earlier release?

This is the exception we are getting:

Connecting to the repository... http://localhost:4502/crx/server
javax.jcr.RepositoryException: Unable to access a repository with the following settings:
    org.apache.jackrabbit.repository.uri: http://localhost:4502/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:223)
        at org.apache.jackrabbit.commons.JcrUtils.getRepository(JcrUtils.java:263)
        at org.nemours.cq.kidshealth.util.RepositoryUtils.getJcrSession(RepositoryUtils.java:67)

...

And this is the heart of the connection code we are using:

Repository repository = JcrUtils.getRepository(getRepositoryUrl() + "/" + getApplicationName());
jcrSession = repository.login(new SimpleCredentials(getUsername(), getPassword().toCharArray()) );

I've seen people comment that missing classpath entries for various libs can cause the empty set of consulted classes. However the jackrabbit-standalone jar is listed in the MANIFEST.MF Class-Path entry. Any help would be greatly appreciated.

1 Reply

Avatar

Level 10

The issue is the Jackrabbit JAR. See this more advanced Java to AEM article: 

https://helpx.adobe.com/experience-manager/using/java-swing-applications.html

Notice the part: 

To successfully connect to the AEM JCR, you still have to include the jackrabbit-standalone-2.4.3.jar (for AEM 5.5) or jackrabbit-standalone-2.6.5.jar (for AEM 5.6, or later) into your project's class path. You can obtain this JAR file from the Java JCR API web page at http://jackrabbit.apache.org/jcr-api.html.

Hope this helps...