Skip to main content
Level 2
Aug 5, 2025 6:23 PM UTC
Solved

Sling Content Distribution - unable to publish the content

Hi Community,

I'm setting up Sling Content Distribution (SCD) in AEM as a Cloud Service to replicate content from Author to Publish using a custom agent and Java code.

Here’s the agent configuration (com.adobe.granite.distribution.core.impl.AgentConfiguration-myagent.config):

 

name="myagent"
enabled=B"true"
serviceName="sling/distribution/service/default"
serializationType="default"
log.level="info"
packageExporter.endpoints=["http://localhost:4503/libs/sling/distribution/services/exporters/default"]
packageImporter.endpoints=["http://localhost:4503/libs/sling/distribution/services/importers/default"]
transportSecretProvider.target="(name=default)"

 

 

And here's the code I'm using to trigger the distribution:

ResourceResolver resolver = resolverFactory.getServiceResourceResolver(
Collections.singletonMap(ResourceResolverFactory.SUBSERVICE, "distributionService"));

DistributionRequest request = new SimpleDistributionRequest(DistributionRequestType.ADD, "/content/myproject/en");

DistributionAgent agent = distributionAgent.get("myagent");
DistributionResponse response = agent.execute(request, resolver.adaptTo(Session.class));

 

The code runs without errors, but content is not getting pushed to Publish. Manual distribution via UI works fine.

SantoshSai
SantoshSaiAccepted solution
Community Advisor
Aug 5, 2025 6:35 PM UTC

Hi @aryaba1,

Could you confirm your Transport Secret Provider.

Make sure you have this config on Author:

# com.adobe.granite.distribution.core.impl.AgentConfiguration-myagent.config
name="myagent"
enabled=B"true"
serviceName="myagent"
serializationType="default"
packageExporter.endpoints=["http://localhost:4503/libs/sling/distribution/services/importers/default"]
transportSecretProvider.target="(serviceName=myagent)"

And on Publish, create this OSGi config:

# com.adobe.granite.distribution.transport.impl.SecretTransportAuthenticationProviderFactory-myagent.config
serviceName="myagent"
username="distribution-user"
password="your-password"

Also worth to check:

  • distribution-user exists on Publish with permissions

  • The importer endpoint (default) is active

  •  myagent matches in code and config

Reference:
https://www.albinsblog.com/2020/08/sling-content-distribution-in-aem-sync-content-between-publish-instances.html

Santosh Sai

4 replies

SantoshSai
Community Advisor
SantoshSaiCommunity AdvisorAccepted solution
Community Advisor
Aug 5, 2025 6:35 PM UTC

Hi @aryaba1,

Could you confirm your Transport Secret Provider.

Make sure you have this config on Author:

# com.adobe.granite.distribution.core.impl.AgentConfiguration-myagent.config
name="myagent"
enabled=B"true"
serviceName="myagent"
serializationType="default"
packageExporter.endpoints=["http://localhost:4503/libs/sling/distribution/services/importers/default"]
transportSecretProvider.target="(serviceName=myagent)"

And on Publish, create this OSGi config:

# com.adobe.granite.distribution.transport.impl.SecretTransportAuthenticationProviderFactory-myagent.config
serviceName="myagent"
username="distribution-user"
password="your-password"

Also worth to check:

  • distribution-user exists on Publish with permissions

  • The importer endpoint (default) is active

  •  myagent matches in code and config

Reference:
https://www.albinsblog.com/2020/08/sling-content-distribution-in-aem-sync-content-between-publish-instances.html

Translate
Santosh Sai
AryaBa1Author
Level 2
Aug 5, 2025 7:03 PM UTC

Thanks @santoshsai it worked after adding the correct serviceName and credentials on the Publish side.

Translate
Level 1
Feb 13, 2026 2:16 PM UTC

Hello ​@SantoshSai , ​@AryaBa1 

I'm trying to setup sling distribution in local author to push/package to local publish.
after creating config I can see an entry in sling distribution and when click on Test connection option getting
org.apache.sling.distribution.common.DistributionException: org.apache.http.client.HttpResponseException: status code: 500, reason phrase: server error

 

followed this 

https://www.albinsblog.com/2020/08/sling-content-distribution-in-aem-sync-content-between-publish-instances.html

 

Translate
joerghoh
Adobe Employee
Adobe Employee
Aug 16, 2025 9:01 AM UTC

Why do you use Content Distribution to replicate content from author to publish? Isn't it possible for you to use the Replication API for that?

 

Translate