Failed to connect to remote VM. Connection refused. when trying to debug remote java application in Flash Builder 4.7

Monte Chan picture Monte Chan · Sep 3, 2013 · Viewed 55.9k times · Source

At one point, the remote debug used to work. But for the life of me, I don't seem to be able to figure out what broke it.

I have a flex/Java application. There is a wrapper that starts the tomcat server. I modified the wrapper.conf file to include

-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

In my flex debug configurations, on the left, I have Remote Java Application. On the right, I have Standard (Socket Attach) as the connection type, 127.0.0.1 (I have tried localhost too) as Host, and 8000 as Port.

The following is the stack trace.

!ENTRY org.eclipse.jdt.launching 4 113 2013-09-03 11:30:49.109 !MESSAGE Failed to connect to remote VM. Connection refused. !STACK 0 java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.(Unknown Source) at java.net.Socket.(Unknown Source) at org.eclipse.jdi.internal.connect.SocketTransportService$2.run(SocketTransportService.java:136) at java.lang.Thread.run(Unknown Source)

Here is a screen shot of the debug configurations. screen shot of the debug configurations

Answer

Monte Chan picture Monte Chan · Nov 14, 2014

After much struggles, I finally got it figured out. I had to make two changes.

  1. I added tomcat.enable.debug=true to my catalina.properties file.
  2. In my wrapper.conf, I had the following lines.

    wrapper.java.additional.9="-Xmx2048m" wrapper.java.additional.10="-XX:MaxPermSize=1024m"

My MaxPermSize was set to a smaller size than Xmx. I had to change that 1024 to 2048.

I then restarted my tomcat and it worked, finally!