Connecting to AEM from JAVA | Community
Skip to main content
Level 4
September 6, 2016
Solved

Connecting to AEM from JAVA

  • September 6, 2016
  • 7 replies
  • 3065 views

Am following up this article[0], where i can observe that if i use  

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

am able to see the below error.

And also has observed that if i use without any server crx detail like 

Repository repository = JcrUtils.getRepository();

then it works and shows the output.

[0] https://helpx.adobe.com/experience-manager/using/programmatically-accessing-cq-content-usi ng.html

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Singaiah_Chintalapudi

kk krish wrote...

Still able to see same error, Attached is my simple java class and pom file which am using, and below is command for running project.

  1. mvn exec:java -Dexec.mainClass="com.org.krish.test.GetRepository"

 

 

 

Everything looks good except the dependency. Add the below dependency and it should work:

<dependency>
           <groupId>org.apache.jackrabbit</groupId>
           <artifactId>jackrabbit-jcr2dav</artifactId>
           <version>2.4.0</version>
     </dependency>

Thanks.

7 replies

Gdubz-57m2mu
Level 5
September 6, 2016

According to this[0], any http(s) URI would use the org.apache.jackrabbit.jcr2dav.Jcr2davRepositoryFactory [1] and I'm not seeing that as one of the RepositoryFactory classes that were consulted. Not exactly an answer, but maybe that'll help you further troubleshoot the issue.

[0] https://jackrabbit.apache.org/api/2.8/org/apache/jackrabbit/commons/JcrUtils.html#getRepository(java.lang.String)
[1] https://jackrabbit.apache.org/api/2.2/org/apache/jackrabbit/jcr2dav/Jcr2davRepositoryFactory.html

Level 8
September 6, 2016

I ran into the same issue.  I added the below code in the first line of my application and it worked correctly.

org.apache.log4j.BasicConfigurator.configure();
smacdonald2008
Level 10
September 6, 2016

This article was written using Eclipse from a standalone app. ie - an external Java Swing app. 

Are you trying to follow this to build an AEM Bundle that is deployed in the OSGi service container? 

KkkrishAuthor
Level 4
September 7, 2016

Still able to see same error, Attached is my simple java class and pom file which am using, and below is command for running project.

mvn exec:java -Dexec.mainClass="com.org.krish.test.GetRepository"

 

smacdonald2008
Level 10
September 7, 2016

Try running code in a Java IDE and let us know what happens. 

Singaiah_Chintalapudi
Singaiah_ChintalapudiAccepted solution
Level 7
September 7, 2016

kk krish wrote...

Still able to see same error, Attached is my simple java class and pom file which am using, and below is command for running project.

  1. mvn exec:java -Dexec.mainClass="com.org.krish.test.GetRepository"

 

 

 

Everything looks good except the dependency. Add the below dependency and it should work:

<dependency>
           <groupId>org.apache.jackrabbit</groupId>
           <artifactId>jackrabbit-jcr2dav</artifactId>
           <version>2.4.0</version>
     </dependency>

Thanks.

KkkrishAuthor
Level 4
September 7, 2016

Thanks it works, But still able to see some warnings in log, attached full command prompt trace.