Expand my Community achievements bar.

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

Export JSON using FileVaultpackageExporter

Avatar

Level 2

This is my use-case:

1. I create some JSONs and upload it in /content/dam/fmdita-outputs
2. Whenever I create new/modify this JSON I want to have these JSON exported [using FileVaultpackageExporter as recommended by google].


I have setup my distribution agent that will basically POST the data [e.g action=ADD&path=%2Fcontent%2Fdam%2Ffmdita-outputs%2Fjson%2Fchild-map-1%2Fchild-map-1-topic_dita.json] to some path based servlet which in turn will process this JSON and then export the same using FileVaultpackageExporter.

I need help with the servlet - how to leverage the FileVaultpackageExporter to have the JSON exported.

Also, I get error as and when I try to distribute any data by making post call to a sample POST servlet. But it works when I setup a dummy node server. 
An error has occurred while attempting to deliver test package. [org.apache.sling.distribution.common.RecoverableDistributionException: not enough rights for http://localhost:4502/bin/distribution/json-exporter]

Note : I tried using admin user but that did not get delivered also.


This is my distribution agent config :

{
  "name": "json-exporter",
  "enabled": true,
  "queue.processing.enabled": true,
  "allowed.roots": ["/content"],
  "packageImporter.endpoints": [
    "http://localhost:4502/bin/distribution/json-exporter"
  ],
  "requestAuthorizationStrategy.target": "(name=default)",
  "transportSecretProvider.target": "(name=default)"
}






1 Reply

Avatar

Level 2

The issue related to An error has occurred while attempting to deliver test package. [org.apache.sling.distribution.common.RecoverableDistributionException: not enough rights for http://localhost:4502/bin/distribution/json-exporter] is resolved.

Now what I currently encounter is test package gets successfully delivered and even manual distribution says successful. But the data does not reach the servlet most probably since the loggers do not get printed.

Attached servlet code and error.log snippets.

14.10.2025 02:07:19.711 *INFO* [[0:0:0:0:0:0:0:1] [1760387839710] POST /libs/sling/distribution/services/agents/json-exporter HTTP/1.1] org.apache.sling.distribution.agent.impl.SimpleDistributionAgent [agent][json-exporter] REQUEST-START DSTRQ12: ADD paths=[/content/dam/fmdita-outputs/json/standalone-map/standalone-map-topic_dita.json], user=admin
14.10.2025 02:07:19.751 *INFO* [sling-threadpool-f25e4dc8-d8bb-4917-bf83-cec80102c205-(apache-sling-job-thread-pool)-24-org_apache_sling_distribution_queue_json-exporter_endpoint0(org/apache/sling/distribution/queue/json-exporter/endpoint0)] org.apache.sling.distribution.agent.impl.SimpleDistributionAgent [agent][json-exporter] [endpoint0] PACKAGE-DELIVERED DSTRQ12: ADD item=dstrpck-1760387839722-cb20c4d3-faee-46a7-bc3a-aaac4966c60a, paths=[/content/dam/fmdita-outputs/json/standalone-map/standalone-map-topic_dita.json], importTime=5ms, execTime=40ms, size=7079B
14.10.2025 02:07:19.774 *INFO* [EventAdminAsyncThread #3] com.adobe.aem.sites.eventing.impl.observers.DistributionListener Distribution event properties [distribution.type, distribution.component.name, distribution.component.kind, distribution.paths, event.topics], isLeader true
14.10.2025 02:07:19.775 *WARN* [EventAdminAsyncThread #3] com.adobe.aem.sites.eventing.impl.observers.DistributionListener Failed conversion of value json-exporter to tier enum
14.10.2025 02:07:19.777 *WARN* [boundedElastic-3] com.adobe.aem.sites.eventing.impl.repository.PersistenceQueryManagerImpl No page found at path /content/dam/fmdita-outputs/json/standalone-map/standalone-map-topic_dita.json
14.10.2025 02:07:19.777 *WARN* [boundedElastic-2] com.adobe.aem.sites.eventing.impl.repository.PersistenceQueryManagerImpl Property not found, path /content/dam/fmdita-outputs/json/standalone-map/standalone-map-topic_dita.json/jcr:content, property cq:lastReplicatedBy, type String
14.10.2025 02:07:19.777 *WARN* [boundedElastic-6] com.adobe.aem.sites.eventing.impl.repository.PersistenceQueryManagerImpl Property not found, path /content/dam/fmdita-outputs/json/standalone-map/standalone-map-topic_dita.json/jcr:content, property cq:lastReplicatedBy, type String
14.10.2025 02:07:19.777 *WARN* [boundedElastic-2] com.adobe.aem.sites.eventing.impl.cache.UserDataCacheImpl Cannot find a user in the lastReplicatedBy property of the resource at path: /content/dam/fmdita-outputs/json/standalone-map/standalone-map-topic_dita.json
14.10.2025 02:07:19.777 *WARN* [boundedElastic-6] com.adobe.aem.sites.eventing.impl.cache.UserDataCacheImpl Cannot find a user in the lastReplicatedBy property of the resource at path: /content/dam/fmdita-outputs/json/standalone-map/standalone-map-topic_dita.json
14.10.2025 02:07:19.777 *WARN* [boundedElastic-2] com.adobe.aem.sites.eventing.impl.repository.PersistenceQueryManagerImpl Model resource at path /content/dam/fmdita-outputs/json/standalone-map/standalone-map-topic_dita.json cannot be adapted
14.10.2025 02:07:19.777 *WARN* [boundedElastic-2] com.adobe.aem.sites.eventing.impl.producer.ContentFragmentModelProducerStrategy Cannot find a valid model data for path /content/dam/fmdita-outputs/json/standalone-map/standalone-map-topic_dita.json
14.10.2025 02:07:19.777 *INFO* [sling-threadpool-f25e4dc8-d8bb-4917-bf83-cec80102c205-(apache-sling-job-thread-pool)-25-<main queue>(com/adobe/cq/dam/sendassetpublishevent)] com.adobe.cq.dam.event.impl.AssetsEventServiceImpl Eventing Producer is unavailable, unable to send Event
14.10.2025 02:07:19.777 *WARN* [boundedElastic-6] com.adobe.aem.sites.eventing.impl.repository.PersistenceQueryManagerImpl Content fragment resource at path /content/dam/fmdita-outputs/json/standalone-map/standalone-map-topic_dita.json cannot be adapted
14.10.2025 02:07:19.777 *WARN* [boundedElastic-6] com.adobe.aem.sites.eventing.impl.producer.ContentFragmentProducerStrategy Cannot find content fragment data for path /content/dam/fmdita-outputs/json/standalone-map/standalone-map-topic_dita.json
14.10.2025 02:07:20.003 *INFO* [CommitStats] CommitStats 13 commits by 2 users [76% sling-event, 23% replication-service] from 2 locations [61% other:java.base/java.lang.Thread.run(Thread.java:834), 38% HTTP-POST:/libs/sling/distribution/services/agents/json-...] [CommitStats overhead was 1ms = 77.0us / commit]



package com.adobe.aem.common.core.servlets;

import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.servlets.SlingAllMethodsServlet;
import org.osgi.framework.Constants;
import org.osgi.service.component.annotations.Component;

import javax.servlet.Servlet;
import javax.servlet.ServletException;

import java.io.*;
import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

@Component(service = Servlet.class, property = {
        "sling.servlet.methods=POST",
        "sling.servlet.paths=/bin/vault/extract"
})
public class VaultBinaryExtractorServlet extends SlingAllMethodsServlet {

    @Override
    protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response)
            throws ServletException, IOException {

        System.out.println("TestReceiverServlet invoked!");
        System.out.println("Content-Type: " + request.getContentType());

        // Log a few headers
        request.getHeaderNames().asIterator().forEachRemaining(h ->
            System.out.println(h + ": " + request.getHeader(h))
        );

        response.setContentType("application/json");
        response.setStatus(200);
        response.getWriter().write("{\"message\": \"POST received successfully\"}");
    }
}


Modified Distribution Agent config :

{
  "name": "json-exporter",
  "enabled": true,
  "queue.processing.enabled": true,
  "allowed.roots": ["/content"],
  "packageImporter.endpoints": [
    "http://localhost:4502/bin/vault/extract"
  ],
  "requestAuthorizationStrategy.target": "(name=default)",
  "transportSecretProvider.target": "(name=default)"
}