Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Error on connecting to JCR using JcrUtils.getRepository (on SSL enabled environment)

Avatar

Level 2

Hi ,

I am trying to access repository from external java application using JcrUtils.

repository = JcrUtils.getRepository("https://localhost:7502/crx/server"); this works
repository = JcrUtils.getRepository("https://localhost:5433/crx/server"); this doesn't work exceptions: javax.jcr.RepositoryException: Unable to access a repository with the following settings:     org.apache.jackrabbit.repository.uri: epository.login The following RepositoryFactory classes were consulted:     org.apache.jackrabbit.jcr2dav.Jcr2davRepositoryFactory: declined     org.apache.jackrabbit.jcr2spi.Jcr2spiRepositoryFactory: declined     org.apache.jackrabbit.commons.JndiRepositoryFactory: declined     org.apache.jackrabbit.core.RepositoryFactoryImpl: declined     org.apache.jackrabbit.rmi.repository.RmiRepositoryFactory: failed         because of IllegalArgumentException: URI is not absolute Perhaps the repository you are trying to access is not available at the moment.         at org.apache.jackrabbit.commons.JcrUtils.getRepository(JcrUtils.java:204)         at org.apache.jackrabbit.commons.JcrUtils.getRepository(JcrUtils.java:244)       Thanks in advance
1 Accepted Solution

Avatar

Correct answer by
Level 9

These jars are not enough to connect to JCR standalone.

Please refer below link for list of jars required.

http://experience-aem.blogspot.ch/2015/05/aem-6-sp2-accessing-crx-remotely-using-jcr-remoting-davex....

View solution in original post

13 Replies

Avatar

Employee Advisor

Have you verified that Webdav is enabled ? What do you see if you directly hit the following URL in the browser ?

https://localhost:5433/crx/server

Avatar

Employee

yagyesh11235 wrote...

Hi ,

I am trying to access repository from external java application using JcrUtils.

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

So it works on port 7502, but not on port 5433? Are you trying to connect to a single AEM instance on two different ports?

It will only work on a single port, if you want to connect on port 5433, you would have to stop AEM, change the port and restart it on 5433. Then 7502 would not work. If you did try to change the port and it didn't work, how did you change the port number?

Regards,

Opkar

Avatar

Level 2

Hi Opkar,

I have enabled ssl for my author environment (running on port 7502) and secured port is 5433.On accessing via 5433 i get an empty repository.

This issue is  happening on AEM 6.1

For CQ 5.6.1 , i have an author environment(running on port 4502) and secured port is 5433.This works 

@kunal123 : I can access the repository via browser for 5433

Avatar

Level 9

What kind of external Java application it is.Please provide more details.

Avatar

Level 2

@kishore:

This is standalone java application which has dependency on  cq-commons-5.8.2.jar,jackrabbit-standalone-2.6.5.jar

Avatar

Level 9

Can you please share the screen-shot of list of jars(related to CQ) you have included to execute your application.

-Kishore

Avatar

Level 2

Hi Kishore,

Attached is the screen shot for the same

Avatar

Correct answer by
Level 9

These jars are not enough to connect to JCR standalone.

Please refer below link for list of jars required.

http://experience-aem.blogspot.ch/2015/05/aem-6-sp2-accessing-crx-remotely-using-jcr-remoting-davex....

Avatar

Level 1

You need 

jackrabbit-standalone jar

 

and 

Jackrabbitjcr2dav jar

 Choose latest versions

Avatar

Level 1

The problem is that org.apache.jackrabbit:jackrabbit-jcr-commons and org.apache.jackrabbit:jackrabbit-jcr2dav have the same file META-INF/services/javax.jcr.RepositoryFactory, which contains the Factory, the correct one is org.apache.jackrabbit.jcr2dav.Jcr2davRepositoryFactory.
Below, this file was removed from jackrabbit-jcr-commons using shade plugin, to avoid conflict with jackrabbit-jcr2dav.

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>org.apache.jackrabbit:jackrabbit-jcr-commons</artifact>
<excludes>
<exclude>META-INF/services/javax.jcr.RepositoryFactory</exclude>
</excludes>
</filter>
</filters>
<finalName>turing-aem</finalName>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>indexer</shadedClassifierName>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>your.mainclass</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>

Avatar

Level 1

@yagyesh11235 @Sandbox1 @Aditya_Band @GK-AEM @Jitendra_S_Toma 
Hi all I'm trying to get the repository but I'm getting the same exception if i open in browser it's working fine, I have search in goggle they are suggesting to use jackrabbit-standalone jar 2.4.0 version in official website of jackrabbit I'm able to find up to 2.21.20 version only.
How to resolve this  and I'm new to this AEM 
Could you please help me