java jdb can't connect to socket
I figured out the problem:
My router's dhcp server shadows an external domain name and I had misconfigured my dhcp server to send my ISPs name servers instead of it's own IP address to clients.
So, java would get back an external ip address when querying my host's ip address.
This problem is happening in fedora, but not in debian with a much earlier kernel. I assume the problem is network related.
I am running fedora 17, SElinux is disabled and iptables rules are flushed.
I'm trying to use a debugger that uses CommandLineLaunch connector and it fails to connect.
I see the same problem if I use jdb.
For example:
jdb -sourcepath . -classpath . test.Test
run
I think it's supposed to launch 2 VMs and attach the debugger to the debugee. But, it
waits and times out, reporting the same error message that I get from the debugger I'm trying to use:
VM start exception: VM initialization failed for: /opt/jdk1.7.0_04/jre/bin/java -classpath . -Xdebug -Xrunjdwp:transport=dt_socket,address=somewhere.com:34165,suspend=y test.Test
ERROR: transport error 202: connect failed: Connection timed out
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
Fatal error:
Target VM failed to initialize.
If I use two command line invocations:
java -agentlib:jdwp=dt_socket,server=y test.Test
it prints the port number that it's listening on, e.g.: 12345
Then:
jdb -attach 12345
Has the same error message.
If I use SocketAttach connector it works:
jdb -connector "com.sun.jdi.SocketAttach:hostname=localhost,port=12345"
Unfortunately, my debugger isn't using that connector.
So, looking at the problem further:
jdb -connect "com.sun.jdi.CommandLineLaunch:main=test.Test"
Has the same error message together with a command line showing that it's using the wrong port number (how would it know anyway).
If I correct the port in the command line:
java -Xdebug -Xrunjdwp=transport=dt_socket,address=127.0.0.1:12345,suspend=n test.Test
It says the handshake fails:
ERROR: transport error 202: handshake failed - connection prematurally closed
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
Attempting to specify "options" for CommandLineLaunch fails to parse, or I don't know how to specify the sub-option:
jdb -connect "com.sun.jdi.CommandLineLaunch:main=test.Test,options=address=127.0.0.1:12345"
Constructs an incorrect command line which fails:
/opt/jdk1.7.0_04/jre/bin/java address=127.0.0.1:12345 -Xdebug -Xrunjdwp:transport=dt_socket,address=127.0.0.1:35276,suspend=y test.Test
What do you think the problem could be?
Last edited by queshaw; 09-19-2012 at 09:28 AM.
Reason: OCD
|