Sling Content Distribution - unable to publish the content | Community
Skip to main content
Level 2
August 5, 2025
Solved

Sling Content Distribution - unable to publish the content

  • August 5, 2025
  • 2 replies
  • 473 views

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.

Best answer by SantoshSai

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

2 replies

SantoshSai
Community Advisor
SantoshSaiCommunity AdvisorAccepted solution
Community Advisor
August 5, 2025

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
AryaBa1Author
Level 2
August 5, 2025

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

Level 1
February 13, 2026

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

 

joerghoh
Adobe Employee
Adobe Employee
August 16, 2025

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?