How to debug UberJar application

As you probably know, UberJar is a special distribution of application - a standalone JAR.

You can easily start UberJar as follows:

java -jar app.jar

But what if there is a problem that cannot be reproduced in a standard Tomcat and occurs only in UberJar? You should definitely debug it!

In order to enable debugging options start app.jar with these options:

java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 -jar app.jar

Java will wait and start application only after you attach debugger.

Then create a new debug configuration with type Remote in Intellij Idea:


Port should be 5005, the same as in Java options.

Debug it!