Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Not able access AEM author using JcrUtils.getRepository

Avatar

Avatar
Level 1
satishs05
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
satishs05
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile
satishs05
Level 1

25-09-2019

I want to access one author crx from another author CRX. For example, I am trying to make a connection from Dev author to QA author. I am using JCRUtil class to access the repository. Below is a code snippet

It is throwing below exception -

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:

org.apache.jackrabbit.commons.JndiRepositoryFactory: declined 

Perhaps the repository you are trying to access is not available at the moment.

I went through some article and forum and it suggested to add below dependency.

org.apache.jackrabbit

jackrabbit-jcr2dav

2.6.0

Even after adding above dependency it is working. Can you please let me if I am missing something or is there another way to make the connection between two author instance?

Thank you

Replies

Avatar

Avatar
Validate 1
MVP
ArpitVarshney
MVP

Likes

136 likes

Total Posts

185 posts

Correct Reply

36 solutions
Top badges earned
Validate 1
Establish
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Validate 1
MVP
ArpitVarshney
MVP

Likes

136 likes

Total Posts

185 posts

Correct Reply

36 solutions
Top badges earned
Validate 1
Establish
Give Back 5
Give Back 3
Give Back 25
View profile
ArpitVarshney
MVP

25-09-2019

Hi satish

Please make sure the following thing:

1. The QA author environment should be up and running.

2. From your example, you have pointed it to localhost in code.It will work if dev author & QA author is on the same machine otherwise you have to give appropriate IP url.

Also,Could you please try the below:

//Create a connection to the CQ repository running on local host

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

//Create a Session- put a valid creds who has the access of the repository

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

//Create a node that represents the root node

Node root = session.getRootNode();

Please refer: How to programmatically access the AEM JCR

Avatar

Avatar
Level 1
satishs05
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
satishs05
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile
satishs05
Level 1

25-09-2019

Hi Arpit,

Thank you for your reply.

I understand QA should be up and running.

I have localhost because I have given you the sample code that I have used.

I have used the code that you mentioned but It is not working.  To test I have created to author instance on diff port in my locale try to access one author from another instance.

Hope this clears your doubt.

Is the code working for you in the scenario I have mentioned?

Avatar

Avatar
Validate 1
Level 2
Santhi_Swaroop
Level 2

Likes

16 likes

Total Posts

28 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 1
Level 2
Santhi_Swaroop
Level 2

Likes

16 likes

Total Posts

28 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile
Santhi_Swaroop
Level 2

25-09-2019

This can also be network issue. are you able to ping your qa server from dev server?

Avatar

Avatar
Give Back 5
Level 2
scottm91515441
Level 2

Likes

5 likes

Total Posts

35 posts

Correct Reply

5 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 5
View profile

Avatar
Give Back 5
Level 2
scottm91515441
Level 2

Likes

5 likes

Total Posts

35 posts

Correct Reply

5 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 5
View profile
scottm91515441
Level 2

25-09-2019

You can also invoke AEM server B from server A via a Servlet. 

Avatar

Avatar
Give Back 5
Level 2
dvnSudheer
Level 2

Likes

13 likes

Total Posts

13 posts

Correct Reply

3 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Boost 5
Boost 3
View profile

Avatar
Give Back 5
Level 2
dvnSudheer
Level 2

Likes

13 likes

Total Posts

13 posts

Correct Reply

3 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Boost 5
Boost 3
View profile
dvnSudheer
Level 2

25-09-2019

Get Repository API is generally used to connect to the instance from a standalone web application to do content creation/updates. Where are you executing this piece of code. Inside a servlet or a service? What is your actual requirement to connect from one environment to other? If you are looking for content sync, there are multiple options like using package manager or Grabbit etc..