I'm trying to connect my best debugger to a remote Glassfish instance (by remote I mean not running on the same physical machine, and not only not in the same VM).
My glassfish domain configuration has the "debug" flag checked, and server.log reports during startup
-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009
Which indicates (to my mind), debugging is indeed enabled.
However, when I try to connect a debugger, it fails. The following session is an example (done with PuTTy) :
$ jdb -connect com.sun.jdi.SocketAttach:port=9009
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:385)
at java.net.Socket.connect(Socket.java:529)
at com.sun.tools.jdi.SocketTransportService.attach(SocketTransportService.java:204)
at com.sun.tools.jdi.GenericAttachingConnector.attach(GenericAttachingConnector.java:98)
at com.sun.tools.jdi.SocketAttachingConnector.attach(SocketAttachingConnector.java:72)
at com.sun.tools.example.debug.tty.VMConnection.attachTarget(VMConnection.java:358)
at com.sun.tools.example.debug.tty.VMConnection.open(VMConnection.java:168)
at com.sun.tools.example.debug.tty.Env.init(Env.java:64)
at com.sun.tools.example.debug.tty.TTY.main(TTY.java:1010)
Fatal error:
Unable to attach to target VM.
What could cause that behaviour ?
EDIT
Notice this jdb command-line has been given as an example of Glassfish debug testing on the web, here is why I used it
Also notice I'm doing this jdb debug session locally (that's to say when connected to that machine using PuTTy, so invoking jdb on the machine Glassifh is running on).