Remote debugging AEMaaCS in docker | Community
Skip to main content
diegov53610848
February 24, 2025
Solved

Remote debugging AEMaaCS in docker

  • February 24, 2025
  • 2 replies
  • 735 views

Hi,

 

I am trying to setup a local AEM instance with docker. So far I was able to setup a Author, Publish and dispatcher. But I only have issues with setting up the JVM remote debugging. I am able to connect the JVM debugger it is just not stopping at the breakpoints. This is the setup :

Dockerfile : 

FROM openjdk:11
WORKDIR /opt/aem
EXPOSE 4502
EXPOSE 5005
COPY author-p4502.jar /opt/aem/author-p4502.jar
COPY start.sh /opt/aem/start.sh
COPY install /opt/aem/install/
RUN chmod +x /opt/aem/start.sh
CMD ["/opt/aem/start.sh"]

Docker-compose.yml :

version: '3.8'
services:
aem-author:
build:
context: ./author
container_name: aem-author
ports:
- "4502:4502"
- "5005:5005"
environment:
- AEM_RUNMODE=author
- JAVA_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
volumes:
- ./author/crx-quickstart:/opt/aem/crx-quickstart

aem-publish:
build:
context: ./publish
container_name: aem-publish
ports:
- "4503:4503"
environment:
- AEM_RUNMODE=publish
volumes:
- ./publish/crx-quickstart:/opt/aem/crx-quickstart

aemaacs-dispatcher:
build:
context: ./adobe-dxp-dispatcher
container_name: aemaacs-dispatcher
ports:
- "80:80"

depends_on:
- aem-publish

volumes:
- ./adobe-dxp-dispatcher/src/conf.d:/etc/httpd/conf.d
- ./adobe-dxp-dispatcher/src/conf.dispatcher.d:/etc/httpd/conf.dispatcher.d

Start.sh :

#!/bin/bash
echo "Starting AEM in author mode and debug port 5033..."
export JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005"
java $JAVA_OPTS -jar /opt/aem/author-p4502.jar &
sleep 60
FLAG_FILE="/opt/aem/install/.package_installed"
if [ ! -f "$FLAG_FILE" ]; then
echo "Deploying content package for the first time..."
curl -u admin:admin -F file=@/opt/aem/install/content.zip -F force=true -F install=true http://localhost:4502/crx/packmgr/service.jsp
touch "$FLAG_FILE"
else
echo "Content package already installed, skipping deployment."
fi
tail -f /dev/null

If someone could help me out that would be great!

Best answer by Tethich

What if you change the CMD in your Dockerfile with smth like this:

 

CMD ["/opt/aem/start.sh", "-p", "4502", "-p", "5005"]

 

I am thinking that you might have an issue with the ports mapping. I know you have specified that already in the Docker-compose.yml file, but still worth trying.

 

Also, maybe you can get some inspiration from this documentation, about additional arguments you can use:
https://github.com/paulrohrbeck/aem-links/blob/master/docker.md#running-aem-650-publish-with-debugging-enabled. I am thinking of trying also the

 

-Dorg.apache.felix.http.host=0.0.0.0

 

2 replies

Tethich
Community Advisor
Community Advisor
February 24, 2025

HI  @diegov53610848 

Can you try to explicitly add -Xdebug to JAVA_OPTS ?

diegov53610848
February 25, 2025

Thanks for the suggestion. But this didn't fix it unfortunately.

Tethich
Community Advisor
TethichCommunity AdvisorAccepted solution
Community Advisor
February 25, 2025

What if you change the CMD in your Dockerfile with smth like this:

 

CMD ["/opt/aem/start.sh", "-p", "4502", "-p", "5005"]

 

I am thinking that you might have an issue with the ports mapping. I know you have specified that already in the Docker-compose.yml file, but still worth trying.

 

Also, maybe you can get some inspiration from this documentation, about additional arguments you can use:
https://github.com/paulrohrbeck/aem-links/blob/master/docker.md#running-aem-650-publish-with-debugging-enabled. I am thinking of trying also the

 

-Dorg.apache.felix.http.host=0.0.0.0

 

kautuk_sahni
Community Manager
Community Manager
March 5, 2025

@diegov53610848 Did you find the suggestion helpful? Please let us know if you need more information. If a response worked, kindly mark it as correct for posterity; alternatively, if you found a solution yourself, we’d appreciate it if you could share it with the community. Thank you!

Kautuk Sahni