LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-16-2012, 09:09 PM   #1
queshaw
LQ Newbie
 
Registered: Sep 2012
Posts: 13

Rep: Reputation: Disabled
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to connect a java client to a BSD server using socket programming sanju.lnt Programming 2 08-06-2011 02:57 PM
Can't connect to UNIX socket /var/run/clamav/clamd.socket ganick Linux - Server 8 08-01-2008 01:22 PM
connection between java socket and unix socket sathishkumar Programming 1 01-10-2006 03:21 PM
Unable to connect to UNIX socket /tmp/.esd/socket error while using grip dr_zayus69 Linux - Software 4 08-23-2005 07:28 PM
connect: socket operation on non-socket bit7 Linux - Networking 0 02-18-2003 05:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration