How to remote debug Java application in Wildfly on a Docker container using Eclipse

Tam Nguyen
2 min readMar 25, 2020

--

If you are developer an Java application which is using Wildfly and Docker for deploying but you sucked at how to debug your application, this post help give you a little bit. You only need to add more some configuration to your application. Let do it.

Step 1 — Prepare standalone.conf file

If you already downloaded the Wildfly you can easily find the standalone.conf at Wildfly folder/bin/standalone.conf

If not you can get here

https://github.com/wildfly/wildfly-core/blob/master/core-feature-pack/src/main/resources/content/bin/standalone.conf

And copy it into your application, for example:

/profile-folder/wildfly/standalone.conf

Next, find the part

# Sample JPDA settings for remote socket debugging

Replace the line

#JAVA_OPTS=”$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n”

with

JAVA_OPTS=”$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=*:8787,server=y,suspend=n”

Step 2 — Config your Dockerfile

# Your docker configsADD wildfly/standalone.xml standalone/configurationCMD [“/opt/jboss/wildfly/bin/standalone.sh”, “-b”, “0.0.0.0”, “-bmanagement”, “0.0.0.0”]

Step 3 — Run your application

docker run — name your-app -p 8787:8787

You should able to find the below log in console

Listening for transport dt_socket at address: 8787

Step 4 — Config your Eclipse

Hit Debug and happy debug

--

--