Java Forum / Tools / January 2004
Debugger
Peter Bradley - 21 Dec 2003 19:00 GMT Hi,
This is in many ways a repost of an earlier query which unfortunately got no response. I'm hoping this may spark some interest.
I have a problem getting the Java debugger to work under Windows XP. At first I thought it was related to the NetBeans IDE, but experimentation has shown that I cannot get the debugger to work in NetBeans, Sun ONE, or JBuilder (haven't tried Eclipse, but I will if anyone wants me to). The error message I get is:
Transport dt_socket failed to initialize, rc = -1.
Connecting/disconnecting my internet connection makes no difference. I also tried changing the transport to dt_shmem in NetBeans, but it still used dt_socket on the command line however I altered the configuration. Issuing the command myself at the command line and substituting dt_shmem for dt_socket simply gave the error:
Error accessing shared memory, rc = -1 Transport dt_shmem failed to initialize, rc = -1 FATAL ERROR in native method: No transports initialized
I have a DSL connection. Could that be significant?
Hope I've stimulated someone's curiosity :)
Peter
Thomas Schodt - 21 Dec 2003 19:13 GMT > I have a problem getting the Java debugger to work under Windows XP. > At first I thought it was related to the NetBeans IDE, but [quoted text clipped - 3 lines] > > Transport dt_socket failed to initialize, rc = -1. Have you tried launching jdb from the command line?
Lookup the options for jdb and java if you need to launch a java app outside the debugger and connect to it with jdb later.
Peter Bradley - 21 Dec 2003 20:30 GMT > > I have a problem getting the Java debugger to work under Windows XP. > > At first I thought it was related to the NetBeans IDE, but [quoted text clipped - 9 lines] > launch a java app outside the debugger > and connect to it with jdb later. Thomas,
Thanks for the reply.
Yes. I obviously didn't make myself clear enough. My apologies. That was what this was meant to indicate:
<snip> Issuing the command myself at the command line and substituting dt_shmem for dt_socket simply gave the error:
Error accessing shared memory, rc = -1 Transport dt_shmem failed to initialize, rc = -1 FATAL ERROR in native method: No transports initialized </snip>
Picking up on what you said though, I tried running the command leaving dt_socket in place. I then get the following error message:
Error [2] in connect() call! er:: No such file or directory Socket transport failed to init. Transport dt_socket failed to initialise, rc = -1 FATAL ERROR in native method: no transports initialized.
Which isn't any different. The command I gave (copied out of the IDE) was as follows:
C:\j2sdk_nb\j2sdk1.4.2\bin\java -Xdebug -Xnoagent -Xrunjdwp:transport=dt_soc ket,address=cymro-ffenestri:1537,suspend=y -Djava.compiler=NONE -classpath "C:\Documents and Settings\peter\.netbeans\3.5\system;C:\Documents and Settings\peter\.netbeans\3.5\system;C:\j2sdk_nb\netbeans3.5.1\system;C:\j2sd k_nb\netbeans3.5.1\modules\ext\AbsoluteLayout.jar;C:\Documents and Settings\peter\.netbeans\3.5\modules\ext\jelly-nb.jar;C:\Documents and Settings\peter\.netbeans\3.5\modules\ext\jelly2-nb.jar;C:\Documents and Settings\peter\.netbeans\3.5\modules\ext\jemmy.jar;C:\Documents and Settings\peter\.netbeans\3.5\modules\ext\junit-3.8.1.jar;C:\Documents and Settings\peter\.netbeans\3.5\modules\ext\junit-testrunner.jar;C:\j2sdk_nb\ne tbeans3.5.1\modules\autoload\ext\servlet-2.3.jar;C:\j2sdk_nb\netbeans3.5.1\l ib\ext\xml-apis-1.0b2.jar;C:\Documents and Settings\peter\.netbeans\3.5\modules\ext\nbjunit.jar;C:\j2sdk_nb\netbeans3.5 .1\beans\TimerBean.jar;C:\javaprojects\javanotes;C:\javaprojects\Ade\Chapter 3" Chapter3.Exercise3_3
Thomas Schodt - 21 Dec 2003 20:58 GMT > That was what this was meant to indicate: > [quoted text clipped - 6 lines] > FATAL ERROR in native method: No transports initialized > </snip> I suspect the dt_shmem is for use on *nix.
> Picking up on what you said though, I tried running the command > leaving dt_socket in place. I then get the following error message: [quoted text clipped - 11 lines] > -Xrunjdwp:transport=dt_socket,address=cymro-ffenestri:1537,suspend=y > -Djava.compiler=NONE -classpath <etc.etc.> It's probably just the options you are specifying (that you got from the IDE).
I'm surprised you have to specify hostname (might try localhost). Also I seem to remember something about ",server=y".
I don't have the manual here. I'll try to remember to look it up tomorrow.
Thomas Schodt - 22 Dec 2003 12:26 GMT Delayed debugging from command line.
jdb (shmem)
> java -Xdebug -Xrunjdwp:transport=dt_shmem,address=<sessionid>, server=y,suspend=y <class> [<arg>]...
> jdb -attach <sessionid> jdb (socket)
> java -Xdebug -Xrunjdwp:transport=dt_socket,address=<port>, server=y,suspend=y <class> [<arg>]...
> jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=<port> Use suspend=n to have the process launch immediately.
Peter Bradley - 22 Dec 2003 15:48 GMT > Delayed debugging from command line. > [quoted text clipped - 9 lines] > > Use suspend=n to have the process launch immediately. Thomas,
Yep, that works - using dt_shmem. And I can attach to the suspended process in the IDE. So that's progress: thanks a lot.
Now, do you (or does anybody) know how I can get an IDE to do the first bit?
Peter
Thomas Schodt - 22 Dec 2003 16:28 GMT > Yep, that works - using dt_shmem. And I can attach to the suspended > process in the IDE. So that's progress: thanks a lot. > > Now, do you (or does anybody) know how I can get an IDE to do the > first bit? In NetBeans. Debug -> Start Session -> Attach gives you a choice between shmem and socket.
Peter Bradley - 22 Dec 2003 17:51 GMT > > Yep, that works - using dt_shmem. And I can attach to the suspended > > process in the IDE. So that's progress: thanks a lot. [quoted text clipped - 5 lines] > Debug -> Start Session -> Attach > gives you a choice between shmem and socket. Sorry Thomas, I'm being vague again.
I have no problem attaching to the running debug session. What I can't do is get the IDE to issue the correct commands to start the VM under the debugger. The IDE issues pretty much the commands the I do at the command prompt, except that it always chooses IPC via a socket. This is in spite of setting it to dt_shmem everywhere I can. OK, this isn't much of a problem when debugging applications, but I don't know how it'll work for applets...
Under Tools | Options, there appears to be some options for controlling how the debugger is called, but I don't seem to be able to get it right. Under Debugging and Executing | Debugger Typer | Default Debugging, I have (as the External Process):
{classic}{assertEnabled}{debuggerOptions} -Djava.compiler=NONE -classpath {q}{filesystems}{q} {main}
Under Debugging and Executing | Exectution Types | Debugger Execution, I have - as the External Process:
{classic}{assertEnabled}-Xdebug -Xnoagent -Xrunjdwp:transport=dt_shmem,serve r=y,suspend=n -Djava.compiler=NONE -Xbootclasspath:{bootclasspath} -cp {filesystems} {classname} {arguments}
As you can see, the transport is set to shmem, but this isn't the command that's issued. This is what's issued when I try to debug wholly from within the debugger (as reported in the Debugger Console output window):
C:\j2sdk_nb\j2sdk1.4.2\bin\java -Xdebug -Xnoagent -Xrunjdwp:transport=dt_soc ket,address=cymro-ffenestri:1338,suspend=y -Djava.compiler=NONE -classpath "<classpath goes here>" Chapter3.Exercise3_1
Even if I change the transport and address, this command still won't run at the command line. It gives me a "shared memory failed to initialize" error. So I don't really know what to change.
Thanks for your continuing help. I really do appreciate it. Sorry if I'm a bit slow to cotton on with some of this (I blame my advancing years).
Cheers
Peter
Thomas Schodt - 23 Dec 2003 09:50 GMT Maybe this is it.
From the NetBeans Debugging FAQ
http://www.netbeans.org/kb/faqs/debugger.html#FAQ_12
runide.exe -J-Dnetbeans.debugger.jpda.transport=dt_shmem
Peter Bradley - 23 Dec 2003 11:33 GMT > Maybe this is it. > [quoted text clipped - 3 lines] > > runide.exe -J-Dnetbeans.debugger.jpda.transport=dt_shmem Hi Thomas,
Tried that some time ago. It gave me an unknown option error. Still, I'll try it again and see what happens.
Will post a new thread after the Christmas holiday.
Have a good holiday, and all the best for the new year. Maybe I'll talk to you in 2004.
Thanks for your help and interest.
Cheers
Peter
Peter Bradley - 22 Dec 2003 22:56 GMT Thomas,
Got the IDE to issue the correct command, but it still won't work from there. It just tells me there's already a program running in the debugger. I can't make any progress from there no matter what I try to do.
I'm going to be away over Christmas, so I won't be able to check the group for 4/5 days.
If you're still interested, I'll post again when I return, with the latest.
Thanks for the help you've given.
Cheers
Peter
> > Yep, that works - using dt_shmem. And I can attach to the suspended > > process in the IDE. So that's progress: thanks a lot. [quoted text clipped - 5 lines] > Debug -> Start Session -> Attach > gives you a choice between shmem and socket. Peter Bradley - 21 Dec 2003 21:18 GMT Thomas,
I now have a bit more info.
First I found that jdb was not on my path, so I fixed that. Still no joy in the IDE.
Ran
jdb <myClass> // <myClass> represents the name of the class I'm trying to debug
from the command line and everything works fine (except for the interface!). That is, the program stopped at the first line, I could set a breakpoint, stop at the breakpoint, step through the code etc, etc.
Ran java -Xdebug -Xrunjdwp:transport=dt_shmem,address=jdbconn,server=y,suspend=n <myClass>
When I issued this command, the program just ran without stopping. When I then issued the command:
jdb -attach jdbconn
I got the message:
Error accessing shared memory, rc = -1 <stack trace> Fatal error Unable to attach to target VM
When I tried the same thing with the transport set to dt_socket, the program did not run but I got the message:
Invalid listen port number jdbconn
When I substituted a (random) port number for jdbconn, I got the error:
Transport dtsocket failed to initialize, rc = 509
Doesn't mean a thing to me, I have to say. Does it to you?
Cheers
Peter
> > I have a problem getting the Java debugger to work under Windows XP. > > At first I thought it was related to the NetBeans IDE, but [quoted text clipped - 9 lines] > launch a java app outside the debugger > and connect to it with jdb later. ConD - 26 Jan 2004 23:19 GMT Hi Peter, I had the same problem which I sorted out tonight. I changed the MS Windows shortcut propertied that I use to start NetBeans from <path to>\runidew.exe to <path to>\runidew.exe -J-Dnetbeans.debugger.jpda.transport=dt_shmem (all on one line). According to the FAQ, the problem occured because the machine wasn't networked, but I was getting the error even if I was logged on to the 'net through my dial up. Therefore, I would expect that your DSL connection would not classify your machine as being 'networked' either. must make it nice & fast to download NetBeans updates though! Best Regards, Conor
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|