I'm using Spring Boot 2.1.5.RELEASE. I want to start the embedded Tomcat server passing in some JVM arguments so that I can debug my application in Eclipse. I tried doing this
localhost:todoapp-backend davea$ java -jar build/libs/todoapp-backend.jar -Drun.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8787"
and also this
localhost:todoapp-backend davea$ java -jar build/libs/todoapp-backend.jar -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8787
but neither seems to do anything since it appears the server starts normally, but my debug port is closed (per telnet) ...
localhost:todoapp-backend davea$ telnet localhost 8787
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host
Use for enabling debugging via remote:
java -jar myapp.jar -Dagentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000
or via maven run goal like :
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
Change address port to any value that you want to use.
In springboot 2 onwards there is no need for the -Drun.arguments part, you can skip that and provide the environment overides arguments directly after -D like :
$ java -jar myproject.jar --spring.config.name=myproject
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With