I want to debug my containerized application running on Wildfly. But it doesn't work. :(
Dockerfile for my application:
FROM jboss/wildfly
ADD standalone-custom.xml /opt/jboss/wildfly/standalone/configuration/
EXPOSE 9990
EXPOSE 8787
CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-c", "standalone-custom.xml", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0", "--debug", "8787"]
docker-compose.yml:
version: '3'
...
services:
...
myappservice:
image: myappimage
ports:
- "8080:8080"
- "8787:8787"
- "9990:9990"
...
When I try to attach a debugger with:
jdb -attach localhost:8787
I receive the following:
java.io.IOException: handshake failed - connection prematurally closed at jdk.jdi/com.sun.tools.jdi.SocketTransportService.handshake(SocketTransportService.java:142) at jdk.jdi/com.sun.tools.jdi.SocketTransportService.attach(SocketTransportService.java:255) at jdk.jdi/com.sun.tools.jdi.GenericAttachingConnector.attach(GenericAttachingConnector.java:119) at jdk.jdi/com.sun.tools.jdi.SocketAttachingConnector.attach(SocketAttachingConnector.java:83) at jdk.jdi/com.sun.tools.example.debug.tty.VMConnection.attachTarget(VMConnection.java:519) at jdk.jdi/com.sun.tools.example.debug.tty.VMConnection.open(VMConnection.java:328) at jdk.jdi/com.sun.tools.example.debug.tty.Env.init(Env.java:63) at jdk.jdi/com.sun.tools.example.debug.tty.TTY.main(TTY.java:1082)
Fatal error: Unable to attach to target VM.
I would be grateful for any suggestions.