The World’s Largest Online Community for Developers

'; java - Maven & Eclipse remote debugging: connection refused - LavOzs.Com

I'm trying to do remote debugging with Maven and Eclipse. On the remote machine, I do mvnDebug spring-boot:run, and on the local machine in Eclipse, I set up a Remote Java Application debug configuration with the appropriate host IP and port and Connection Type as Standard (Socket Attach).

On the remote machine, before attempting to connect with Eclipse, I only see:

Preparing to execute Maven in debug mode
Listening for transport dt_socket at address: 8000

ss -aln shows something listening on port 8000: users:(("java",pid=949917,fd=4)). As soon as I start the debug process in Eclipse on the local machine, the regular Maven output appears on the remote machine:

Apache Maven 3.6.3 (NON-CANONICAL_2019-11-27T20:26:29Z_root)                                                 
Maven home: /opt/maven                                                                                       
Java version: 1.8.0_242, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-8-openjdk/jre                
Default locale: en_US, platform encoding: UTF-8                                                              
OS name: "linux", version: "5.5.8-arch1-1", arch: "amd64", family: "unix"                                    
[INFO] Scanning for projects...

so apparently a connection is made. The output from Maven is identical to a regular run. But Eclipse displays Failed to connect to remote VM. Connection refused. with no additional information, and by now nothing is listening on port 8000 on the remote machine anymore.

I don't have any idea how to even debug this, and the config couldn't be simpler.

The contents of the mvnDebug script are:

MAVEN_DEBUG_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"

echo Preparing to execute Maven in debug mode


Any suggestions or insight would be appreciated.

Like maven-surefire-plugin with forked test, springboot seems to fork to a new jvm process. Hence, mvnDebug won't help you in that case: to debug your springboot instance from Maven, you must set up appropraite jvmArguments per this link:

        -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005

While I can not explain why you can't connect using remote debug, my hint is that Spring Boot let maven terminates. I did not test but this would explain why you can't connect with Eclipse.

Note that mvnDebug is mainly for debugging maven and plugins, rather than your own application.

The run config you tried is for java 4 and below.

for java 5 and above try to use for MAVEN_OPTS:


How to duplicate a whole line in Vim at Eclipse?
How can you speed up Eclipse?
How can I create an executable JAR with dependencies using Maven?
'Must Override a Superclass Method' Errors after importing a project into Eclipse
“Debug certificate expired” error in Eclipse Android plugins
Remote debugging Tomcat with Eclipse
How to add local jar files to a Maven project?
Remote Debugging with Eclipse and tomcat
Issue with Maven Jetty Debug - Eclipse (Breakpoints are getting skipped)
How to do remote debugging using intellij?