score:178
Why don't you just right click on the main()
method and choose "Debug As... Java Application"
?
score:0
score:2
Please see http://java.dzone.com/articles/how-debug-remote-java-applicat to enable the remote debugging. If you are using tomcat to run your application, start tomcat with remote debug parameters or you can start tomcat with JPDA support by using following command.
Windows
<tomcat bin dir>/startup.bat jpda
*nix
<tomcat bin dir>/startup.sh jpda
this will enable remote debugging on port 8000
score:2
With eclipse or any other IDE, just right click on your main spring boot application and click "debug as java application"
score:3
This question is already answered, but i also got same issue to debug Springboot + gradle + jHipster,
Mostly Spring boot application can debug by right click and debug, but when you use gradle, having some additional environment parameter setup then it is not possible to debug directly.
To resolve this, Eclipse provided one additional features as Remote Java Application
by using this features you can debug your application.
Follow below step:
run your gradle application with
./gradlew bootRun --debug-jvm
command
Now go to eclipse --> right click project and Debug configuration --> Remote Java Application.
add you host and port as localhost and port as 5005 (default for gradle debug, you can change it)
Refer for more detail and step.
score:3
Right click on the spring boot project -> debug as -> spring boot App
. Put a debugger point and invoke the app from a client like postman
score:5
score:14
The best solution in my opinion is add a plugin in the pom.xml, and you don't need to do anything else all the time:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9898
</jvmArguments>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
score:16
Run below command where pom.xml
is placed:
mvn spring-boot:run -Drun.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
And start your remote java application with debugging option on port 5005
score:21
I didn't need to set up remote debugging in order to get this working, I used Maven.
- Ensure you have the Maven plugin installed into Eclipse.
- Click Run > Run Configurations > Maven Build > new launch configuration:
- Base directory: browse to the root of your project
- Goals:
spring-boot::run
.
- Click Apply then click Run.
NB. If your IDE has problems finding your project's source code when doing line-by-line debugging, take a look at this SO answer to find out how to manually attach your source code to the debug application.
Hope this helps someone!
score:21
How to debug a remote staging or production Spring Boot application
Server-side
Let's assume you have successfully followed Spring Boot's guide on setting up your Spring Boot application as a service.
Your application artifact resides in /srv/my-app/my-app.war
, accompanied by a configuration file /srv/my-app/my-app.conf
:
# This is file my-app.conf
# What can you do in this .conf file? The my-app.war is prepended with a SysV init.d script
# (yes, take a look into the war file with a text editor). As my-app.war is symlinked in the init.d directory, that init.d script
# gets executed. One of its step is actually `source`ing this .conf file. Therefore we can do anything in this .conf file that
# we can also do in a regular shell script.
JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,address=localhost:8002,server=y,suspend=n"
export SPRING_PROFILES_ACTIVE=staging
When you restart your Spring Boot application with sudo service my-app restart
, then in its log file located at /var/log/my-app.log
should be a line saying Listening for transport dt_socket at address: 8002
.
Client-side (developer machine)
Open an SSH port-forwarding tunnel to the server: ssh -L 8002:localhost:8002 myusername@staging.example.com
. Keep this SSH session running.
In Eclipse, from the toolbar, select Run -> Debug Configurations -> select Remote Java Application -> click the New button -> select as Connection Type Standard (Socket Attach), as Host localhost, and as Port 8002 (or whatever you have configured in the steps before). Click Apply and then Debug.
The Eclipse debugger should now connect to the remote server. Switching to the Debug perspective should show the connected JVM and its threads. Breakpoints should fire as soon as they are remotely triggered.
score:28
Easier solution:
Instead of typing mvn spring-boot:run
,
simply type mvnDebug spring-boot:run
You will still need to attach the debugger in Eclipse by making a new Debug Configuration for a "Remote Java Application" on the relevant port.
score:100
There's section 19.2 in Spring Boot Reference that tells you about starting your application with remote debugging support enabled.
$ java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n \
-jar target/myproject-0.0.1-SNAPSHOT.jar
After you start your application just add that Remote Java Application configuration in Run/Debug configurations, select the port/address you defined when starting your app, and then you are free to debug.
Source: stackoverflow.com
Related Query
- How to debug Spring Boot application with Eclipse?
- how to debug spring application with gradle
- How to run Spring Boot web application in Eclipse itself?
- How to solve "Secure storage was unable to save the master password" in Eclipse CDT remote application with SSH password debug connection?
- How do I create a Spring Boot Starter Project in Eclipse that is properly configured with a Run Configuration?
- How to run and debug C++ application in Eclipse that's started with a script?
- How to debug remote deployed spring boot app & maven on eclipse
- Java Spring boot application with OpenCv : UnsatisfiedLinkError under Eclipse if use spring-boot-devtools
- How to remote debug two spring boot applications running in the same container with the same codebase but with different profiles?
- Whitelabel Error Page : Spring Boot Application with Eclipse
- how to debug application as root in eclipse in Ubuntu?
- Exporting Spring Boot application as JAR file in eclipse
- How to run spring boot application both as a web application as well as a command line application?
- Running Spring Boot application through Eclipse picks up test classes
- How to run spring boot app in Eclipse tomcat?
- How does Eclipse debug code in an application server?
- how to debug java web application in eclips with weblogic server
- How to debug CUDA using eclipse Nsight with only one GPU
- On Linux, Debugging a C++ application with gdb in Eclipse CDT, how to input something to stdin?
- How to configure jboss application server with eclipse IDE
- How to add an Icon to an application built with Eclipse Galileo C and MinGW?
- How do I debug a remote application in my eclipse
- How do I debug Android native lib in eclipse with ARM DS-5 without going crazy?
- How to debug Groovy code via the remote Java application debugging in Eclipse
- Spring boot how to make project run on server in eclipse
- How to debug PHP application using Eclipse PDT (xdebug and zend debugger)
- How to open Spring Boot sample in Eclipse STS
- SpringBoot: How to provide VM Argument in Spring Boot App, while running from Eclipse
- How Can I Change The Location of Image Files Created by BIRT in a Spring Boot Application
- Spring Boot application suddenly stops after outputing logo and version on Eclipse
More Query from same tag
- Glassfish Server Adapter in Eclipse (java.lang.IllegalArgumentException: port out of range:1118080)
- Problem with Eclipse default equals() implementation
- How to push only a subset of committed files?
- Search classes from SWT UI in eclipse plugin development
- Debugging an Android app in Eclipse using the handset
- Android SharedPreferences force closes app
- operator | for int value
- Why does Eclipse think that my XML syntax is wrong?
- Applet Not Initialized
- Installation errors when installing executables for EclipseFP
- Eclipse for PHP
- eclipse JavaFX css resource not found
- Unable to execute dex: Multiple dex files define Lcom/actionbarsherlock/R$attr
- How to add images to resource chooser?
- How would you change your programs Icon instead of the default java icon
- Two separate JREs for junit and source in eclipse project
- How to buld a Maven project with a specified java home property in eclipse?
- Searching files in Eclipse
- Eclipse: How can I set the {user} variable?
- Multiple jar file introspection
- How can I add a short path in the build path of Eclipse?
- Difference between running a statement on Evaluate-Expression vs Watches intellij?
- How to set the git property sslBackend = schannel in Spring Tool Suite 4
- Creating Eclipse Keylogger Plugin?
- ERROR StatusLogger Log4j2 could not find a logging implementation
- eclipse cdt value not shown correctly during debug, always 0
- Error for Maven Structure in Eclipse
- how to do interactive debug on nodeclipse
- How to install the Xpand in Eclipse?
- Error in finding intent with mainactivity finding intent