0
votes

I am trying to access the repository from a standalone java application using JcrUtils.

**repository = JcrUtils.getRepository("http://localhost:4502/crx/server"); this works**

**repository = JcrUtils.getRepository("https://localhost:4502/crx/server"); this doesn't work** 

Exception in thread "main" javax.jcr.RepositoryException: Unable to access a repository with the following settings: org.apache.jackrabbit.repository.uri: https://localhost:4502/crx/server The following RepositoryFactory classes were consulted: org.apache.jackrabbit.commons.JndiRepositoryFactory: declined org.apache.jackrabbit.core.RepositoryFactoryImpl: declined org.apache.jackrabbit.jcr2dav.Jcr2davRepositoryFactory: declined org.apache.jackrabbit.jcr2spi.Jcr2spiRepositoryFactory: declined 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 com.hero.jcr.util.CqHelper.getSession(CqHelper.java:20) at com.hero.jcr.commandline.CheckConnection.getDamAssets(CheckConnection.java:36) at com.hero.jcr.commandline.CheckConnection.main(CheckConnection.java:29)

Thanks in advance

1
It might be some certificate issue as you are trying https. - Sadistic
Does AEM has SSL in place? Take a look here: docs.adobe.com/content/help/en/experience-manager-65/… - ronnyfm

1 Answers

0
votes

The problem can have different causes.

  1. HTTPS configured and on which port

It looks like you're trying to access http and https in the same situation on the same port. Http and Https don't run on the same port in parallel. Please use the SSL Wizard as hinted by ronnyfm to check if SSL is activated and on which port it is used: https://docs.adobe.com/content/help/en/experience-manager-65/administering/security/ssl-by-default.html For instance the default port for https in AEM is 8443, so try https://localhost:8443 to access it, if you have configured it there.

  1. Untrusted Certificate

Also connecting to https might not work if you use an untrusted certificate, which you need to add to the Java security keystore first. In my case I got the same "Unable to access" message, because the original exception regarding the certificate got silently swallowed in the JCR library I was using.

  1. Wrong certificate

When you added the certificate to the keystore and it still doesn't work, check if the certificate was created for them same host you request. If you created it for bla.host, but try to access it via localhost, it also gives you the same exception, while the original message is silently swallowed.