Getting JDI Connector Settings
Hi All,
I have a jvm that is already running a debugee application. I now want to be able to attach a socket connector to it to listen for events in that program. However, I have a reference to the jvm but I do not know how to find what port the debugee application is running on. Is there a way I can find out what connector or port the application is running on ? thank-you
Brian
> Hi All,
Hello
> I have a jvm that is already running a debugee
> ee application. I now want to be able to attach a
> socket connector to it to listen for events in that
> program. However, I have a reference to the jvm but I
> do not know how to find what port the debugee
> application is running on.
What kind of reference to the debugee JVM do you have?
> Is there a way I can find
> out what connector or port the application is running
> on ? thank-you
Usually this is part of the contract between the debugger
and debugee. If the debugger is launching the debugee,
then it already has all the necessary information since
it is in control.
In your case, the debugee is started first and the debugger
needs to attach later. At present, you need to use some
pre-arranged port number or shared memory name to set up
the connection. You can't connect to the debugee to ask
the question because... you don't have the address.
This is the topic of Bug-ID 4527279
http://developer.java.sun.com/developer/bugParade/bugs/4527279.html
We are working on solutions to this chicken/egg problem.
Some other relevant bug-IDs are:
4841257
http://developer.java.sun.com/developer/bugParade/bugs/4841257.html
4717237
http://developer.java.sun.com/developer/bugParade/bugs/4717237.html
Hope this helps.
Hi,
I have this reference to the users jvm (usersJvm):
it = Lookup.getDefault().lookup(new Lookup.Template(Debugger.class)).allInstances().iterator();
while (it.hasNext()) {
mutlisessionDebugger = ((EnterpriseDebugger)it.next());
}
System.out.println("Got debugger of Type: " + mutlisessionDebugger);
sessionDebugger = (JPDADebugger)mutlisessionDebugger.getCurrentDebugger();
usersJvm = sessionDebugger.getVirtualMachine();
I am using Linux so I do not have the shared memory option. It would be great if there was someway to query the user's JVM for all its connections and search these to see the name of the programs loaded. The connection that matches the program name could then send you details about its port for example. Will this sort of information be available in the next release ? I am also waiting for the 4.0 JPDADebugger API release which I was told will be in April'04 so that I don't have to be searching my way through the source code. Thanks for the information
Brian