Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.
SOLVED

facing issue while creating live copy from blueprint via the java

Avatar

Level 1

aem : aem-cloud
i tried to create live copy from the blueprint via the java code...
which i followed this way using wcmcommand servlet, am getting error 

25.07.2025 21:37:02.283 *ERROR* [[0:0:0:0:0:0:0:1] [1753459622282] GET /bin/simpleservlet HTTP/1.1] com.day.cq.wcm.msm.impl.commands.CreateLiveCopyCommand Wrong endpoint called, (bin/wcmcommand), to create live copy from /content/aus/language-masters/pf-pf to /content/aus/pf/pf

what am i missing here, i used entire code from above article to test.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @SyntaxError_07,

Looks like CreateLiveCopyCommand expects to be invoked through/bin/wcmcommand with cmd=createLiveCopy via a POST, but in your case the request that hit AEM was:

GET /bin/simpleservlet

So you (or the sample you copied) are calling the command indirectly from your own servlet, and the command detects it was not reached through the right endpoint and aborts.

What you’re likely missing

  1. HTTP method & endpoint

    • You must POST to /bin/wcmcommand, not GET your own /bin/simpleservlet.

    • Required params typically are: cmd=createLiveCopy, srcPath, destPath, (optionally title, deep, reset, rolloutConfigs, etc.).

  2. AEMaaCS restriction

    • On AEM as a Cloud Service the /bin/wcmcommand servlet is discouraged / often blocked by dispatcher rules. Even if you fix the endpoint/method, it may still be rejected in Cloud. The recommended way is to use the MSM Java API (LiveRelationshipManager) programmatically, not the legacy wcmcommand endpoint.

  3. You invoked the OSGi command directly

    • If you referenced/instantiated CreateLiveCopyCommand (or routed to it) from your own servlet, it will always complain because it checks request.getServletPath() and wants it to be /bin/wcmcommand.


Santosh Sai

AEM BlogsLinkedIn


View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

Hi @SyntaxError_07,

Looks like CreateLiveCopyCommand expects to be invoked through/bin/wcmcommand with cmd=createLiveCopy via a POST, but in your case the request that hit AEM was:

GET /bin/simpleservlet

So you (or the sample you copied) are calling the command indirectly from your own servlet, and the command detects it was not reached through the right endpoint and aborts.

What you’re likely missing

  1. HTTP method & endpoint

    • You must POST to /bin/wcmcommand, not GET your own /bin/simpleservlet.

    • Required params typically are: cmd=createLiveCopy, srcPath, destPath, (optionally title, deep, reset, rolloutConfigs, etc.).

  2. AEMaaCS restriction

    • On AEM as a Cloud Service the /bin/wcmcommand servlet is discouraged / often blocked by dispatcher rules. Even if you fix the endpoint/method, it may still be rejected in Cloud. The recommended way is to use the MSM Java API (LiveRelationshipManager) programmatically, not the legacy wcmcommand endpoint.

  3. You invoked the OSGi command directly

    • If you referenced/instantiated CreateLiveCopyCommand (or routed to it) from your own servlet, it will always complain because it checks request.getServletPath() and wants it to be /bin/wcmcommand.


Santosh Sai

AEM BlogsLinkedIn


Avatar

Level 5

When I wrote this article, I had tried in AEM On-Prem instance and not in AEM Cloud. Can you please try the following? Instead of /bin/wcmcommand, use 

 

/bin/msm/createLiveCopy with following params

 

srcPath: Path to the source (blueprint) page
destPath: Path where the live copy should be created
title: Title of the live copy
description: (Optional) Description
rolloutConfigs: (Optional) Rollout configuration

Avatar

Level 1
26.07.2025 06:24:47.877 *WARN* [[0:0:0:0:0:0:0:1] [1753491287872] GET /bin/simpleservlet HTTP/1.1] org.apache.sling.servlets.post.impl.SlingPostServlet Exception while handling POST on path [/bin/msm/createLiveCopy] with operation [org.apache.sling.servlets.post.impl.operations.ModifyOperation]
java.lang.IllegalArgumentException: Can't create child on a synthetic root

I tried with service user for this /bin/msm/createLiveCopy, still facing above issue.

Avatar

Community Advisor

@SyntaxError_07 
This servlet is undocumented and may not be available or supported in AEMaaCS, especially since Cloud Service restricts direct servlet access. 

Rather I would suggest to go with alternative approach and use MSM API programmatically

You can use the LiveCopyManager API in your custom code (OSGi service or servlet). Here’s the outline:

  1. Inject LiveCopyManagerFactory to obtain a LiveCopyManager instance.

  2. Use createLiveCopy method to create a Live Copy between the blueprint and the target location.

Sample code

@Reference
private LiveCopyManagerFactory liveCopyManagerFactory;

public void createLiveCopy(ResourceResolver resolver, String blueprintPath, String liveCopyPath) throws WCMException {
    LiveCopyManager liveCopyManager = liveCopyManagerFactory.getLiveCopyManager(resolver);

    Resource blueprint = resolver.getResource(blueprintPath);
    Resource liveCopyParent = resolver.getResource(liveCopyPath).getParent();

    if (blueprint != null && liveCopyParent != null) {
        liveCopyManager.createLiveCopy(blueprint, liveCopyParent, liveCopyParent.getName(), null);
    } else {
        throw new IllegalArgumentException("Blueprint or target path is invalid.");
    }
} 

Santosh Sai

AEM BlogsLinkedIn


Avatar

Level 1

Since the LiveCopyManager was not available, I initially used PageManager.copy() to duplicate the page, and then established the live copy relationship using LiveRelationshipManager.establishRelationship().