Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Remote JCR Session from Standalone Java program for AEM Cloud Instance

Avatar

Level 4

Hi All,

Is it possible to get a JCR session from a standalone Java program for an AEM instance running in a cloud? We have a usecase where we need to manipulate properties of hundreds of assets under a folder tree based on the parent folder name (such as pdfs, photos) etc. I was thinking about writing a java program to recursively crawl down the folder and inspect various nodes under the main folder and manipulate it as needed. I can get the jcrsession running AEM SDK in local machine but I am skeptical that it will work for the AEM instance running in the cloud as I would not have access to /crx/server node.

Anyone has attempted to do this before? I would greatly appreciate any helpful pointers.

 

Thanks,

SKM_AEM

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

No, JCR remoting is not possible with AEM CS.

View solution in original post

3 Replies

Avatar

Community Advisor

Hi @skmAem ,
What you are trying to achieve can be done in 2 ways:

1. Write the code in Java and trigger it based on a servlet. This way you can push the code to cloud and then simply trigger the code on hit of the servlet, when you want to.

2. Write a groovy script, and run it in the groovy console. This would not need any code changes to be pushed. Although, you can push the script through code and then run it in the groovy console.

 

https://hashimkhan.in/aem-adobecq5-code-templates/groovy-script/ 

Avatar

Level 4

Hi @Anmol_Bhardwaj ,

 

Thanks for the reply. I will look into the servlet route as I am not familiar with Groovy. I wish there was a way to get a AEM/sling/jcr session from a standalone Java program for better debugging/tracing.

 

Thanks again!

-SKM

Avatar

Correct answer by
Employee Advisor

No, JCR remoting is not possible with AEM CS.