Level 2
March 5, 2024
Solved
Remote Debug AEM running inside docker container using vscode
- March 5, 2024
- 1 reply
- 1371 views
Hello,
I'm having a hard time getting remote debugging to work in vscode for my local AEM instance which is running inside a docker container.
I have tried various configurations and when I try to connect I get the "com.dun.jdi.connect.spi.closedconnectionexception" error ( see attached). I'm hoping someone can help spot the issue.
Author Dockerfile
FROM aem-base-image
# Expose AEM author port 4502 and debug port 5005
EXPOSE 4502
EXPOSE 5005
# Make the container start always in Author mode with Port 4502
# ---ENTRYPOINT METHOD---
ENTRYPOINT ["java", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005", "-jar", "cq-quickstart.jar", "-Dsling.run.modes=author", "-p", "4502"]
Docker Compose .yml
version: '3'
services:
author:
image: aem-author
build: ./aem-author
ports:
- "4502:4502"
- "5005:5005"
publish:
image: aem-publish
build: ./aem-publish
ports:
- "4503:4503"
- "5010:5010"
VSCODE launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Attach to Remote Program - AEM Author",
"request": "attach",
"hostName": "localhost",
"port": "5005",
"projectName": "aem-my-projectName.core"
},
{
"type": "java",
"name": "Attach to Remote Program - AEM Publish",
"request": "attach",
"hostName": "localhost",
"port": "5010",
"projectName": "aem-my-projectName.core"
},
{
"type": "java",
"name": "Current File",
"request": "launch",
"mainClass": "${file}"
}
]
}
Thanks in advance. If I figure it out I'll post a follow up. For the moment I am at a loss.