Well I am answering myself after a long time; in my specific case, the solution was to put eclipse JVM in listening mode:
Connection Type: "Standard (Socket Listen)"
and reverse the direction of the tunnel:
ssh -L 8001:localhost:8001 user@work (run on server (S), "localhost" is W) ssh -R 8001:localhost:8001 user@work (run at home (H), "localhost" is W)
Some explanation: as in the question, my situation was:
H -------------------> S not working ( ssh -L 8001:S:8001 user@S from H) H W -------> S working ( ssh -L 8001:S:8001 user@S from W) home work server
While reversing like this:
H <------- W S ssh -R 8001:localhost:8001 user@W (from H) H W <------- S ssh -L 8001:localhost:8001 user@W (from S) home work server
did the trick. In other words, whatever is written on S:8001, is forwarded to W:8001, and whatever in turn is written to W:8001, is forwarded to H:8001, where my eclipse JVM is listening.
The tomcat JVM on S should be started with server=n, with arguments:
Can you please give the exact parameters of the -Xrunjdwp parameter?
Also do you have tried different methods for debugging (server=y/n, suspend=y/n)?
Perhaps inversing the connection (let the tomcat connect to the debugger instead of letting the debugger connect to tomcat) may help.
Assuming the remote Tomcat instance has been started with something like
-Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n, try this command:
ssh -L 8000:0.0.0.0:8000 email@example.com -N
On my Mac, I tried out
ssh -L 10701:localhost:10700 user@localhost -N locally, where a Tomcat instance was started with
-Xrunjdwp:transport=dt_socket,server=y,address=10700,suspend=n, and attempting to attach on port 10701 within Eclipse, I kept seeing "Failed to connect to remote VM com.sun.jdi.connect.spi.ClosedConnectionException". By changing the tunnel command to
ssh -L 10701:0.0.0.0:10700 user@localhost -N, Eclipse was able to attach.
This article suggests that the default port on which the remote Java virtual machine (JVM) is listening in debugging mode is 1044. You should tunnel the port on which the remote JVM is running as well.
More generally, you could run wireshark/tcpdump to see to which port connection attempts are made when starting the debugger.
A few more things I would try:
- check on the remote host (e.g. with
ps auxwwwif it's Linux) with which arguments (look for what comes behind
lsof -p PID_OF_JVM_TO_BE_DEBUGGEDon which TCP port it listens (look for lines with
- make sure that the JVM on the remote host listens on the
lointerface, not the network interface (that's what you specify with the
-Loption to ssh).
- Does starting the debugger by hand on the machine where you start eclipse with
jdb -attach localhost:8000work ? (you could also try this on the remote host to ensure the debugger is running on the port 8000)
- make sure that eclipse tries to connect to
localhost(when not specifying a bind address before the first 8000 with the
-Loption ssh listens on the
I often had this problem when doing remote debugging. I do not know the exact reason for this problem, but I used the below solution and maybe it works for you, too:
ssh -L 8000:localhost:8000 user@remotehost
ssh -L 8000:remotehost:8000 user@remotehost
for creating the SSH tunnel (note the remotehost instead of localhost between the port numbers in the second example). Instead of the remote host's name, you can also use the normal IP address of the remote host (not the loopback address 127.0.0.1, but the true local network IP address).
Hope it helps and good luck!
- eclipse: remote debugging a tomcat server behind a firewall
- Remote debugging Tomcat with Eclipse
- Installing a remote Tomcat server in Eclipse
- Remote Debugging with JPDA won't connect to Tomcat through eclipse when using Docker-Compose
- Eclipse 3.4 + Tomcat 6.0 + Remote Debugging with Console Output
- Debugging a remote Java application with Eclipse as the server (Socket listen)
- Remote debugging on Tomcat with Eclipse
- How to fix eclipse spinning CPU while debugging on tomcat server
- Debugging remote application in Eclipse using Tomcat
- remote debugging with maven tomcat and eclipse
- Remote debugging Tomcat with Eclipse - breakpoints ignored
- Remote Debugging Tomcat 7 with Eclipse Mars on MacOS X
- tomcat server instance debugging in the eclipse
- How to deploy web project on remote tomcat server outside Eclipse with .jar files in it
- Remote debugging the server Jboss eap 6.4 is failing from Eclipse
- Debugging with Eclipse - Tomcat server window disappears on initiating Debug in Eclispe
- Remote debugging tomcat in eclipse
- Eclipse add Tomcat 7 blank server name
- Apache Tomcat Not Showing in Eclipse Server Runtime Environments
- Why tomcat server location property is greyed in Eclipse
- Tomcat 6 server creation using eclipse IDE on ubuntu
- Cannot add a project to a Tomcat server in Eclipse
- Eclipse 4.2 (Juno) 'Cannot create a server using the selected type' in Tomcat 7
- How to add Tomcat Server in eclipse
- How do you connect an eclipse to a WebSphere Application server hosted on remote server?
- Is there a way to force Eclipse to automatically restart remote debugging (in listen mode)?
- Remote deploy Tomcat webapp from Eclipse
- Eclipse on-click deploy to remote Tomcat
- Connect Eclipse RSE with remote Linux server using public key attained from Amazon ec2
- Eclipse Tomcat7 Server Doesnt support Remote Host
More Query from same tag
- unique_ptr autocomplete in eclipse
- Using more than one preference store for Eclipse Editor Plugin
- How to get Eclipse style code completion in Android Studio
- Working on Android development in eclipse, I'm getting a "must override or implement a supertype method" error, researched solutions not working
- Is there a way to make Eclipse open a hyperlinked java file from another project from the same workspace
- Reading in one file and writing out to another fails
- Gradle project doesn't import classes out of other projects or javax.persistence
- Unable to install ICEfaces plugin in eclipse
- Null Pointer Exception Error on a Constructor
- CodeMR Analyzer in Eclipse does not work with C/C++ Code
- Birt Report Line Break in PDF format
- Servlet Throws Exception at Runtime in Eclipse
- Google App Engine for java: my peoject structure is diffrent
- overload operator + c++ eclipse
- Java simple JFrame is null
- How to convert a maven dependeny from the local repo to a maven project in eclipse ?
- Eclipse hangs during debugging with "Evaluating" thread
- Eclipse: Open file in PyDev Console
- Is there a quick way to decrease the indentation of multiple lines in Python?
- why my python file can run in IDEL but can not in Eclipse?
- I hosted a server in eclipse by tomcat but cant access localhost:8080 or my jsp page from browser
- How to build a scanner with stringtokenizer
- SpringBoot via Spring Tool Suite in Eclipse Luna builds not working project
- How a java program knows if it has been started by eclipse's `debug` not `run`?
- Windows 8 & Eclipse ADT Plugin
- android start activity and keep running previous
- Joining Two Entities in Spring Data JPA
- Creating a BIRT Data Set with Dynamic Data - ORA-01722
- After adding selenium lib jar files, eclipse does not show any output and javaw.exe crash is shown in event log
- Android Emulator Error Eclipse Juno