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

Error: Locked Pages cannot be replicated

Avatar

Level 2

I am getting an error while performing a customized workflow for deactivation. The flow of the workflow is:

Lock payload-->Create version-->Approval sent to content admin--> Approved by content admin-->Deactivate Page/Asset-->Unlock Payload.

 

I am getting the following error:

 

com.adobe.granite.workflow.WorkflowException: Process execution resulted in an error
at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:204)
at com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:275)
at org.apache.sling.event.impl.jobs.JobConsumerManager$JobConsumerWrapper.process(JobConsumerManager.java:502)
at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.startJob(JobQueueImpl.java:351)
at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.access$100(JobQueueImpl.java:60)
at org.apache.sling.event.impl.jobs.queues.JobQueueImpl$1.run(JobQueueImpl.java:287)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
Caused by: com.adobe.granite.workflow.WorkflowException: Failed to execute process
at com.day.cq.workflow.compatibility.CQWorkflowProcessRunner.execute(CQWorkflowProcessRunner.java:108)
at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:194)
... 8 more
Caused by: com.day.cq.workflow.WorkflowException: com.day.cq.replication.ReplicationException: Locked pages cannot be replicated. The owner needs to unlock the page first. Cannot perform replication
at com.day.cq.wcm.workflow.process.ReplicatePageProcess.execute(ReplicatePageProcess.java:209)
at com.day.cq.workflow.compatibility.CQWorkflowProcessRunner.execute(CQWorkflowProcessRunner.java:93)
... 9 more
Caused by: com.day.cq.replication.ReplicationException: Locked pages cannot be replicated. The owner needs to unlock the page first. Cannot perform replication
at com.day.cq.wcm.core.impl.VersionManagerImpl.preprocess(VersionManagerImpl.java:364)
at com.day.cq.replication.impl.ReplicatorImpl.replicate(ReplicatorImpl.java:474)
at com.day.cq.wcm.workflow.process.ReplicatePageProcess.execute(ReplicatePageProcess.java:189)
... 10 more

 

I am using 6.5.13 version, is there any feature in AEM 6.5.13 that locked pages cannot be replicated?

Note: I am not getting this error in 6.3 version while performing the same steps.

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

You have to change the sequence 

Lock payload(process)-->Create version(process)-->Approval sent to content admin(Participant)--> Approved by content admin(Participant)-->Unlock Payload(process)-->Deactivate Page/Asset(process).

 

 



Arun Patidar

View solution in original post

6 Replies

Avatar

Community Advisor

Hi @STJ_1234 

There is a code in replication Pre Processor 

 

if (page.isLocked()) {
throw new ReplicationException("Locked pages cannot be replicated. The owner needs to unlock the page first. Cannot perform replication");
}

 

which prevents any replication for locked pages.

 

The Product itself doesn't allow Replication of locked pages.

Can you please elaborate on the use case where you want to replicate a locked page?

 

Thanks

Avatar

Level 2

Hi @ksh_ingole7 

Thanks for your reply !

While migrating one of the custom workflow from 6.3 to 6.5, I am facing this issue. The payload will be locked as Author has initiated a workflow on the same. After which the page will be deactivating and it unlocks . As you have mentioned it doesn't allow locked pages to be replicated, is it the same in 6.3?. Because I am not facing this  issue in 6.3 version. The pages are getting replicated even though it is locked in 6.3. Is this feature only in higher versions? I am currently using 6.5.13 version.

Avatar

Community Advisor

Yes this was working for me in AEM 6.3.2, when we migrated to 

6.5.5 we faced the same issue. I think it is safe to assume this was added in higher versions of AEM.

 

You might have to manually unlock the page or do it via a script if the number is more. But would not recommend it as it would defy the purpose of locked pages. Pages are locked by content Authors for reviews before publishing. 

Thanks

Avatar

Employee Advisor

IIRC it was added in AEM 6.4. 

 

Can you please describe the usecase you are working on? I could imagine a requirement, that a page is locked until it's activated, and afterwards it should be unlocked. Of course this can built using multiple workflow steps, but it would be nice if the replication or a pre/post process step could perform this ootb.

Avatar

Correct answer by
Community Advisor

You have to change the sequence 

Lock payload(process)-->Create version(process)-->Approval sent to content admin(Participant)--> Approved by content admin(Participant)-->Unlock Payload(process)-->Deactivate Page/Asset(process).

 

 



Arun Patidar

Avatar

Community Advisor

We had a similar requirement for workflow where the pages should be locked when being published.

This workflow had Publish to Stage -> followed by Review step -> followed by Publish to Live.

Page is locked right after workflow is triggered for it.

Just before Publish to Stage, the workflow unlocks the page and after publishing, locks it again during the Review process.

When time arrives for Publish to Live, same thing. unlock -> publish -> -> Email -> End.

 

As mentioned by others in this thread, this security feature will let authors discover if a page is available for editing (by its locked status) and prevent a workflow from accidently publishing a page being worked upon or in another active workflow.

Of course, this comes with some additional work, as you rightly pointed out.

While doing this, you might as well consider additional scenarios, like,

the page properties is editable for a locked page (or at least gives an impression of being available - greeting the Author with an error when saving properties), unless you restrict access to it explicitly and

the page must be unlocked and workflow terminated while the page is still being processed by the workflow due to a change in business decision to not send the page to Live anymore.