I want to remote debug a Java application in Wildfly/Tomcat embedded in a Docker container. I want to debug the application in VsCode; I also tried to remote debug in IntelliJ. For both I am getting the same error:
Error running 'Tomcat in Docker': Unable to open debugger port (localhost:9000): java.net.SocketException "Connection reset"
docker-compose
version: '3.7'
services:
wildfly:
image: jboss/wildfly:latest
ports:
- 8088:8080
- 9990:9990
- 8787:8787
entrypoint: "/opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0 --debug"
tomcat:
image: tomcat:10
environment:
- JPDA_ADDRESS=8000
- JPDA_TRANSPORT=dt_socket
ports:
- 8888:8080
- 9000:8000
entrypoint: "/usr/local/tomcat/bin/catalina.sh jpda run"
launch.json in VsCode
{
"configurations": [
{
"type": "java",
"name": "Attach Wildfly",
"request": "attach",
"hostName": "localhost",
"port": "8787"
},
{
"type": "java",
"name": "Attach Tomcat",
"request": "attach",
"hostName": "localhost",
"port": "9000"
}
]
}
netstat -tuplen | grep 8787
tcp 0 0 0.0.0.0:8787 0.0.0.0:* LISTEN 0 257375 -
tcp6 0 0 :::8787 :::* LISTEN 0 257380 -
netstat -tuplen | grep 9000
tcp 0 0 0.0.0.0:9000 0.0.0.0:* LISTEN 0 255587 -
tcp6 0 0 :::9000 :::* LISTEN 0 253926 -
Any ideas? Thanks.