Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » "Cannot connect to VM" while Debugging
"Cannot connect to VM" while Debugging [message #142074] Tue, 07 March 2006 16:27 Go to next message
Eclipse UserFriend
Originally posted by: kai.hannemann.gmx.net

I'm using WinXP SP2, newest eclipse, newest jdk.
Debugging worked just fine until today. I wanted to debug a simple
application and get the message "Cannot connect to VM" when hitting debug.
There are no details available (button greyed out).

I'm pretty sure I didn't change any settings concerning windows, eclipse
or java.
To resolve the problem I already tried the following:
* trying to debug in Windoes safe mode
* using system restore back to a date where everything was still working
* deinstalled and reinstalled jdk
* reinstalled eclipse

Nothing worked. I have no idea what happened and I have no other idea left
than to completely reinstall my OS.

Any ideas would be gratly appreciated!
Re: "Cannot connect to VM" while Debugging [message #142087 is a reply to message #142074] Tue, 07 March 2006 16:47 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 143
Registered: July 2009
Senior Member
First, are you trying to connect to a remote or internal VM? If you're
connecting to a remote VM, use "netstat -a" to verify your VM is listening
on the JPDA port you expect. In addition, make sure that another process
hasn't already connected to the port you're trying.

I'm not too familiar with what Eclipse does with an internal VM, but you
should be able to look at similar information. In general, make sure your
JDK is listening on the port you expect, and your client is the only
connecting to that listener.
Re: "Cannot connect to VM" while Debugging [message #142092 is a reply to message #142087] Tue, 07 March 2006 17:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kai.hannemann.gmx.net

David Karr wrote:

> First, are you trying to connect to a remote or internal VM?

I'm not using a remote VM.

> I'm not too familiar with what Eclipse does with an internal VM, but you
> should be able to look at similar information. In general, make sure your
> JDK is listening on the port you expect, and your client is the only
> connecting to that listener.

I don't really know how to do all that.
Here's what tcpview says when I hit "debug"

proc: javaw.exe:2740
protocol: tcp
local adress: 0.0.0.0:1453
remote adress: 0.0.0.0:0
state: listening

Are ports even concerned when I don't use a remote VM?
btw: I have no firewall installed. so there can't be blocked anything.
Re: "Cannot connect to VM" while Debugging [message #142098 is a reply to message #142092] Tue, 07 March 2006 19:05 Go to previous messageGo to next message
Kevin Barnes is currently offline Kevin BarnesFriend
Messages: 174
Registered: July 2009
Senior Member
Even local debug sessions use a socket connection. WinXP SP2 has a built
in firewall. Have you tried disabling it?
What VM are you running? Are the target and host VM's the same?


Kai Hannemann wrote:
> David Karr wrote:
>
>> First, are you trying to connect to a remote or internal VM?
>
> I'm not using a remote VM.
>
>> I'm not too familiar with what Eclipse does with an internal VM, but
>> you should be able to look at similar information. In general, make
>> sure your JDK is listening on the port you expect, and your client is
>> the only connecting to that listener.
>
> I don't really know how to do all that.
> Here's what tcpview says when I hit "debug"
>
> proc: javaw.exe:2740
> protocol: tcp
> local adress: 0.0.0.0:1453
> remote adress: 0.0.0.0:0
> state: listening
>
> Are ports even concerned when I don't use a remote VM?
> btw: I have no firewall installed. so there can't be blocked anything.
>
Re: "Cannot connect to VM" while Debugging [message #142144 is a reply to message #142098] Tue, 07 March 2006 22:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kai.hannemann.gmx.net

> Even local debug sessions use a socket connection. WinXP SP2 has a built
> in firewall. Have you tried disabling it?

The service is disabled. I can guarantee there's no firewall active.

> What VM are you running?

I don't know exactly. Converning java I only istalled the latest jdk from
sun.
How can I find out what VM I'm running?

>Are the target and host VM's the same?

Again how do I find out what target and host VM I'm using?
Re: "Cannot connect to VM" while Debugging [message #142153 is a reply to message #142144] Tue, 07 March 2006 22:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kai.hannemann.gmx.net

OK I just found out where the logfile is.
This is the full log of the error:

!ENTRY org.eclipse.jdt.launching 4 120 2006-03-07 16:59:47.296
!MESSAGE Cannot connect to VM
!STACK 0
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at java.net.ServerSocket.<init>(ServerSocket.java:97)
at
org.eclipse.jdi.internal.connect.SocketTransportService.star tListening(SocketTransportService.java:275)
at
org.eclipse.jdi.internal.connect.SocketTransportImpl.startLi stening(SocketTransportImpl.java:47)
at
org.eclipse.jdi.internal.connect.SocketListeningConnectorImp l.startListening(SocketListeningConnectorImpl.java:108)
at
org.eclipse.jdt.internal.launching.StandardVMDebugger.run(St andardVMDebugger.java:196)
at
org.eclipse.jdt.launching.JavaLaunchDelegate.launch(JavaLaun chDelegate.java:101)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:590)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:515)
at
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:733)
at
org.eclipse.debug.internal.ui.DebugUIPlugin$6.run(DebugUIPlu gin.java:931)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
Re: "Cannot connect to VM" while Debugging [message #142163 is a reply to message #142074] Tue, 07 March 2006 23:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: e0326320.student.tuwien.ac.at

Kai Hannemann wrote:

> I'm using WinXP SP2, newest eclipse, newest jdk.
> Debugging worked just fine until today. I wanted to debug a simple
> application and get the message "Cannot connect to VM" when hitting debug.
> There are no details available (button greyed out).

I have exactly the same problem!!!! I have the same system (winXP, sp2).

> Nothing worked. I have no idea what happened and I have no other idea left
> than to completely reinstall my OS.
> Any ideas would be gratly appreciated!

I hope someone has a solution for this problem, this problem is really
annoying...
Re: "Cannot connect to VM" while Debugging [message #142206 is a reply to message #142144] Wed, 08 March 2006 16:20 Go to previous messageGo to next message
Kevin Barnes is currently offline Kevin BarnesFriend
Messages: 174
Registered: July 2009
Senior Member
If you haven't explicitly specified the VM, it will use the default.
Enter "java -version" on the command line to get the details of the VM
your host uses.

The VM used by your target is specified on the JRE tab in the Launch
Configuration Dialog.


We use the following method to find an available port.
public static int findFreePort() {
ServerSocket socket= null;
try {
socket= new ServerSocket(0);
return socket.getLocalPort();
} catch (IOException e) {
} finally {
if (socket != null) {
try {
socket.close();
} catch (IOException e) {
}
}
}
return -1;
}
What do you get if you run that code?


Kai Hannemann wrote:
>> Even local debug sessions use a socket connection. WinXP SP2 has a
>> built in firewall. Have you tried disabling it?
>
> The service is disabled. I can guarantee there's no firewall active.
>
>> What VM are you running?
>
> I don't know exactly. Converning java I only istalled the latest jdk
> from sun.
> How can I find out what VM I'm running?
>
>> Are the target and host VM's the same?
>
> Again how do I find out what target and host VM I'm using?
>
Re: "Cannot connect to VM" while Debugging [message #142233 is a reply to message #142153] Wed, 08 March 2006 19:37 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 143
Registered: July 2009
Senior Member
Ok, this means that some other process (or another part of Eclipse,
theoretically) has created a server socket on that port. Before you start
Eclipse, run "netstat -a" and search for something listening on your JPDA
port (was it 1453?). That will only tell you if something is listening,
but not necessarily what. You could use the TCPView application from
Sysinternals to give you a graphical view of what netstat shows, along
with the owning process.
Re: "Cannot connect to VM" while Debugging [message #142253 is a reply to message #142206] Wed, 08 March 2006 20:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kai.hannemann.gmx.net

Kevin Barnes wrote:

> If you haven't explicitly specified the VM, it will use the default.
> Enter "java -version" on the command line to get the details of the VM
> your host uses.

it says:
"java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)"

> The VM used by your target is specified on the JRE tab in the Launch
> Configuration Dialog.

it's pointed to the directory where I isntalled the latest jre to.

> We use the following method to find an available port.
> public static int findFreePort() {
> ServerSocket socket= null;
> try {
> socket= new ServerSocket(0);
> return socket.getLocalPort();
> } catch (IOException e) {
> } finally {
> if (socket != null) {
> try {
> socket.close();
> } catch (IOException e) {
> }
> }
> }
> return -1;
> }
> What do you get if you run that code?

Before a fresh restart: 1985
Everytime i rerun the code the ports increses by 1
After a fresh restart: 1055 also increases by 1 everytime it's rerun
Re: "Cannot connect to VM" while Debugging [message #142273 is a reply to message #142233] Wed, 08 March 2006 21:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kai.hannemann.gmx.net

> Ok, this means that some other process (or another part of Eclipse,
> theoretically) has created a server socket on that port. Before you start
> Eclipse, run "netstat -a" and search for something listening on your JPDA
> port (was it 1453?). That will only tell you if something is listening,
> but not necessarily what. You could use the TCPView application from
> Sysinternals to give you a graphical view of what netstat shows, along
> with the owning process.

Here's what happens when I hit debug in eclipse: javaw opens an (unused)
serversocket (the one Kevin Barnes' code would return), listens at this
port and keeps listening. So when I hit debug 20 times i get 20 entries in
tcpview of javaw listening on different ports.
I made a screenshot for illustration (some ips removed)

http://img482.imageshack.us/img482/852/ports3pw.jpg
Re: "Cannot connect to VM" while Debugging [message #142382 is a reply to message #142273] Thu, 09 March 2006 15:38 Go to previous message
Kevin Barnes is currently offline Kevin BarnesFriend
Messages: 174
Registered: July 2009
Senior Member
Kai Hannemann wrote:
>> Ok, this means that some other process (or another part of Eclipse,
>> theoretically) has created a server socket on that port. Before you
>> start Eclipse, run "netstat -a" and search for something listening on
>> your JPDA port (was it 1453?). That will only tell you if something
>> is listening, but not necessarily what. You could use the TCPView
>> application from Sysinternals to give you a graphical view of what
>> netstat shows, along with the owning process.
>
> Here's what happens when I hit debug in eclipse: javaw opens an (unused)
> serversocket (the one Kevin Barnes' code would return), listens at this
> port and keeps listening. So when I hit debug 20 times i get 20 entries
> in tcpview of javaw listening on different ports.
> I made a screenshot for illustration (some ips removed)
>
> http://img482.imageshack.us/img482/852/ports3pw.jpg
>

Kai,
Seems funny that your system is behaving like this. The code to find a
port has been this way in the JDT Debugger for some time now.
Please file a bug against JDT-Debug component.
Thanks
Kevin
Previous Topic:Microsoft-like search
Next Topic:Document base with tomcat
Goto Forum:
  


Current Time: Wed Apr 24 16:47:29 GMT 2024

Powered by FUDForum. Page generated in 0.10809 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top