Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

How to replicate config nodes from author to publish programmatically ?

Avatar

Level 3

I am trying to replicate config nodes from author to publish instances programmatically. I used the replication service ( replicator.replicate(session, ReplicationActionType.ACTIVATE, nodePath);) ,

but I am getting Error while building replication content com.day.cq.replication.AccessDeniedException: error. 

 

The session is from system user and I gave all the permissions to it, but no luck. Also I tried manual replication from crxde and getting the below error

Agent-user does not have sufficient permission.

 

However, content activation works. Request to help me in this

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @sivas61374651 ,

The agent-user in the replication agent must be given permission on the publish instance for the config nodes. If you have multiple instances in your set up, then each of them must carry write permissions on the nodes you are replicating.

The errors tell me that the agent-user has permissions on the /content nodes but missing write  permissions on the  config nodes on the publish servers.

Once you allow the correct permissions, the config nodes must be replicated without any issues.

 

Hope that helps!

 

Thanks,

PreetpalSingh 

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hello @sivas61374651 ,

The agent-user in the replication agent must be given permission on the publish instance for the config nodes. If you have multiple instances in your set up, then each of them must carry write permissions on the nodes you are replicating.

The errors tell me that the agent-user has permissions on the /content nodes but missing write  permissions on the  config nodes on the publish servers.

Once you allow the correct permissions, the config nodes must be replicated without any issues.

 

Hope that helps!

 

Thanks,

PreetpalSingh 

Avatar

Level 5

Just to confirm this theory, did you test using local host instead of a real env? It might confirm if it's an issue with replication user access for target publisher or if it's something else. And just to understand are you rendering to osgi config nodes or conf folder items or something else? 

Avatar

Community Advisor

Hello Sivas,

 

Can you please share some more detail about the business case that you want to achieve? Ideally any config (properties) should be part of the code and placed on servers (author, publish) during the deployment. If you can provide more insight about your expectation, will be able to help with standard solution.

 

Thanks 

Avatar

Community Advisor

Hi @sivas61374651,

Although the purpose of replicating configs from author to publish instances is not clear enough, if you still want to publish programmatically, you should ensure the following minimal permissions on the respective nodes:

  • Author: Read, Replicate (System User)
  • Publish: Modify (Agent User)

Author permission is required to fix the AccessDeniedException, while Publish permission is necessary to apply changes to the Publish instance.