I am trying to debug a Grails 3.x application using grails run-app --debug-fork
. But when the application starts it does not wait for the debugger to attach. Any solution on how to debug a Grails 3.x application?
Asked
Active
Viewed 4,893 times
13

Marco
- 15,101
- 33
- 107
- 174
4 Answers
20
Please use the --debug-jvm
flag.
For example: grails --debug-jvm run-app

pablovilas
- 583
- 6
- 10
-
3Is there a way to use this option with an IDE? – IcedDante Feb 23 '16 at 04:11
-
@IcedDante You can easily use it in any IDE by configuring the run setup by simply writing `--debug-jvm` in the command fields. All standard IDEs support additional command line arguments. – Saqib Ahmed Mar 24 '17 at 11:52
-
this opens the interactive console, doesn't run the app – Pablo Pazos Aug 10 '22 at 04:47
3
The other option is to directly run the Application
class located in grails-app/init
. It has a static void main
and be run as a regular application. You can run it directly from your IDE with a debug profile.

rzymek
- 9,064
- 2
- 45
- 59
3
In IntelliJ IDEA 2016.1, I create two configurations. This allows me to make solid use of all the context menus, etc. that IntelliJ IDEA offers. Here's how:
- The first configuration is a "Run" configuration. Edit the default
configuration and in the "Command Line" field, enter
run-app --debug-jvm
- The second configuration is a "Remote" configuration. On the "Run/Debug" dialog, click the + symbol and select "Remote" from the list. Name it "Debug" and save.
- Select your "Run" config from the config dropdown at the top and then click the green arrow to run the app. Monitor the console
output until you see the message
Listening for transport dt_socket at address: 5005
. - Select the remote debug profile you created in step 2 and click the debug button. In a few moments the console output will say
Grails application running at http://localhost:8080 in environment: development
.
Success!

jmorhardt
- 183
- 2
- 3
- 15
-
My Project is running fine but if i try to debug as steps provide above i got this error ERROR org.apache.tomcat.jdbc.pool.ConnectionPool - Unable to create initial connections of pool. – Ashu Oct 20 '16 at 12:36
-
in gradle file I added this buildscript->dependencies-> classpath 'mysql:mysql-connector-java:5.1.29' now it works :) – Ashu Oct 20 '16 at 13:18