4

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

Monte Chan
  • 1,193
  • 4
  • 20
  • 42
  • 2
    I don't understand what you mean by "on the left" and "on the right" in terms of debug configurations. If you're referring to a Flash Builder/Eclipse screen, you may consider posting a screenshot. – JeffryHouser Sep 03 '13 at 19:03
  • Make sure you're still running the debug Flash Player (for example, a chrome update could have installed a new version of Flash Player or something). – Sunil D. Sep 03 '13 at 19:06
  • Reboog711, a screen shot is included in my post per your request. Sunil, debug flash player appears to be running because the Flex break points do work and I can debug the Flex part of the codes. – Monte Chan Sep 03 '13 at 20:06
  • 1
    You should check if the port is really open, e.g. with `netstat -n -a -p tcp` there should be a line like `TCP 0.0.0.0:8000` – splash Sep 04 '13 at 07:06
  • No, I do not see TCP 0.0.0.0:8000. In fact, I don't see anything with port 8000 on the list. I have tried opening that port in the inbound rules in my firewall (I have Windows 7) and then click the Debug button in Debug configuration screen. I am still getting the message saying "cannot connect to VM" and netstat still does not show TCP 0.0.0.0:8000. – Monte Chan Sep 04 '13 at 13:58
  • Well, my machine got a blue screen of death and was rebuilt. After the rebuilt, I had to re-set up everything. Now, splash, I actually see tcp 0.0.0.0:8000 as listening and tcp 127.0.0.1:8000 as Established when debugging. However, Flash Builder still does not break at the breakpoints in the java file. – Monte Chan Jan 16 '14 at 22:18
  • any luck on this? I'm having a similar problem. Used to work before but doesn't seem to work anymore. – Saeid Nourian Nov 12 '14 at 05:14

5 Answers5

6

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!

Monte Chan
  • 1,193
  • 4
  • 20
  • 42
4

Each debug argument must be placed in a line by itself, after the -vm argument. This should do the trick:

-vmargs
-Xdebug 
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
BenMalik
  • 64
  • 5
2

Eclipse is not very verbose for this error "Connection refused". One has to check three entries here.
1. Fully qualified host name or IP
2. Correct port number.
3. At Tomcat level heck below:

Some versions of Tomcat has "dt_shmem" entry instead of "dt_socket". Change it to dt_socket in catalina.bat. The line should looks like this:
set JPDA_TRANSPORT=dt_socket

bummi
  • 27,123
  • 14
  • 62
  • 101
Dilip M D
  • 19
  • 3
0

We must start Tomcat in remote mode rightly, otherwise just setting related variable cannot solve the problem. My solution is below and that works for my situation: Connection refused problem solution

Community
  • 1
  • 1
Mustafa Kemal
  • 1,292
  • 19
  • 24
0

If you validate Eclipse configuration settings and see that both hostname/IP and port name are correct, try to restart eclipse

committedandroider
  • 8,711
  • 14
  • 71
  • 126