Expand my Community achievements bar.

SOLVED

Exception while accessing AEM repository

Avatar

Community Advisor

We have two AEM instances and trying to access one AEM instance repository on other AEM instance. 

I've created workflow process where I used below to code to access. But it is throwing below exception when the process is executed.

Piece of code: 

Repository repository = JcrUtils.getRepository("http://localhost:4502/crx/server");
//Create a Session
Session session = repository.login( new SimpleCredentials("admin", "admin".toCharArray()),"crx.default"); 

Exception: Unable to access a repository with the following settings:
org.apache.jackrabbit.repository.uri: localhost:4502/crx/server
The following RepositoryFactory classes were consulted:
Perhaps the repository you are trying to access is not available at the moment.

But the same code is working when I write Standalone java class to access AEM repository and it is not working only when I try to access AEM repository from other AEM server. Please advise if I'm missing anything. Quick response would be appreciated.

Thanks

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi,

your error is "org.apache.jackrabbit.repository.uri: localhost:4502/crx/server" and are these two instances on the same server or separate servers? If you are using localhost I am guessing the same server.

If the same server, I would expect you to use 4502 for one and 4504 for the other(convention is to have even port numbers for author and odd for publish instances)

If you are running the code on the instance running on port 4502 you should be connecting to localhost:4504.

The servlet should be on the server running the workflow. But get your code calling correctly first.

The idea of the servlet is that it takes in a parameter, calculates whether a workflow contains the page as a package and returns a JSON response. 

Regards,

Opkar

View solution in original post

5 Replies

Avatar

Employee

Hi,

what are you trying to achieve? Can you not just make a rest call and get the contents of a node? Or are you looking to update content. If you want to get some results and process the contents, perhaps considering making a servlet on the other server.

What ports are both your servers running on? 

Regards,

Opkar

Avatar

Level 1

@Opkar_Gill  @Siva_Sogalapalli  I'm trying to invoke the crx server I'm also getting same error 
If i try in browser it working fine, could you please help me how to resolve this and if I search in google it suggesting to use jackrabbit-standalone-2.4.0 version and I'm not able to find this version in google. 

Avatar

Community Advisor

Hi Opkar,

Thank your for your reply.

I wanted to access the page information of other AEM server (Author) and check whether the page is associated with workflow or not. As you suggested I've created a AEM servlet to access the other AEM repository. But I'm getting same exception. 

Both servers are running on port 80. (To make sure, I've also tested with different ports.)

Please advise.

Avatar

Community Advisor

Opkar, Thank you very much for your time.

Avatar

Correct answer by
Employee

Hi,

your error is "org.apache.jackrabbit.repository.uri: localhost:4502/crx/server" and are these two instances on the same server or separate servers? If you are using localhost I am guessing the same server.

If the same server, I would expect you to use 4502 for one and 4504 for the other(convention is to have even port numbers for author and odd for publish instances)

If you are running the code on the instance running on port 4502 you should be connecting to localhost:4504.

The servlet should be on the server running the workflow. But get your code calling correctly first.

The idea of the servlet is that it takes in a parameter, calculates whether a workflow contains the page as a package and returns a JSON response. 

Regards,

Opkar