Remote Debugging Fails with IntelliJ but works with Eclipse? - eclipse

I'm attempting to debug a program running in WebSphere Liberty Profile, so I run this on the server:
./server debug
This prints out
Listening for transport dt_socket at address: 7777
In IntelliJ IDEA, version 13.1.3, I try:
Run > Edit Configurations > + > Remote.
I pick Socket, Attach, fill in the hostname, and enter the port number of 7777, give it a name, and then OK.
Run > Debug > Pick the name I just gave it.
It opens a debugger tab and after ~30 seconds it displays the message
Error running (debugger configuration name):
Unable to open debugger port:
java.net.ConnectException "Connection timed out: connect"
(Line breaks added to make it easier to read).
I can then launch Eclipse, Kepler Service Release 2, and do
Run > Debug Configurations... > Remote Java Application > New > give it a name, pick Socket Attach, give it the host name and port number of 7777, click Apply, and Debug.
And it works just fine.
The fact that I can run Eclipse and have it work fine and IntelliJ and have it fail at the same time indicates to me that the problem isn't anywhere on my server and it's not an issue with my network connection.
It seems to me that the problem must lie somewhere in how I've set up IntelliJ. So my question is: what could I have done right with Eclipse that I'm getting wrong with IntelliJ?

The error message shows that IntelliJ IDEA can't establish a network connection to the debuggee process. One common reason for this problem is a local firewall rule that blocks network connections from IntelliJ IDEA.

Related

Why is Eclipse now knocking my jpda debugger port offline?

I've used the tomcat jpda debugger a thousand times and I know I have tomcat setup correctly. Now, when I go to attach my eclipse debugger to the remote tomcat jpda, it won't attach and also knocks the port offline.
I can confirm the debugger port is listening on the Linux server with netstat -nlp | grep 8000. As soon as I try to attach from Eclipse, the port is no longer lisening. Anyone seen this ?
Update: The port comes back after I close Eclipse so it must be partially working, but I see no output in the debug perspective and break points are not hit so something else is up. Possibly VPN related.

Tomcat : Unable to connect for remote debugging

I am trying to debug server side code (running on Tomcat) using eclipse's remote debug option. This issues is showing up intermittently and rest of the times it works just fine. I have made sure
1) Server side has got the latest Jars - I copied the .war file and redeployed.
2) Tomcat is running on debug mode and firewall settings have been modified to allow connections on the debug port.
3) Verified that before the attempt to connect, on the server its listening on the debug port and afterwards it shows that connection has been established.
but Eclipse is throwing an error popup saying "Its unable to connect to the remote VM" and sometimes it times out waiting for a packet #
Should I be checking for some more things? Are there any more log files by eclipse that throws light on what went wrong? Please help
This is can be a solution sometimes if your debugger fails to connect to debugger with an error something like "timed out while waiting for a packet #packetnumber" then it could be because of the low timeout setting and slow network. One can increase the timeout value using debug setting in the eclipse preferences.

Debug points not working in eclipse for a remote application

I have a Java application running on a WebLogic server. I have kept breakpoints in the doPost() method of the servlet I want to invoke on that server.
When I invoke that servlet, it is not stopping at any of the debug points. The WebLogic port used by the application is 3304. When I give this port in the debug configuration it throws the following error:
Failed to connect to remote VM. Connection refused.
Connection refused: connect
If I give any other ports, e.g. 3305, 3303 it opens the debug view, but the application cannot be debugged.
The JVM will be running on debug port 3304 only. So other ports will not work. The error you get may be because, the debug connection to this port is already made by another machine or client, or an existing connection started by you was not terminated. You will get the exact stacktrace from eclipse, when you click on More details>.
Quick Try: Restart the JVM.(Sorry for this tip if its a production server)
Have you started the VM with these params, which exposes the correct port and starts the server in debug mode.
-Xdebug -Xrunjdwp:transport=dt_socket,address=<port number>

GWT JUnit tries to contact the wrong IP address

I am trying to run GWT Junit tests in eclipse Juno (right-click on test case file and "run as GWT JUnit test case"). However, JUnit fails with an exception saying the connection refused on an IP address other than the one of my client machine.
(I'm manually inserting an extra space in the URLs to avoid stackoverflow blocking the post because of bad URLs).
Starting http://192.168.1.234:46278/org.me.MyProject.JUnit/junit-standards.html?gwt.codesvr=192.168.1.234:46971 on browser FF3
logging for HtmlUnit thread
[ERROR] I/O error on HTTP request
org.apache.http.conn.HttpHostConnectException: Connection to http://192.168.1.234:46278 refused
My machine's IP address is 192.168.1.3. I have no clue from where eclipse got the other IP. Where does eclipse get the erronous address and how can I change it, preferably to 127.0.0.1?
The answer to the above question was that there was a malconfigured DNS server involved. Eclipse read the hostname of the machine and resolved it to the wrong IP number.

Debugging Play with Eclipse

I am trying to debug my Play application with Eclipse. First I launch it using Run As: Application.launch
That seems to work.
Then I try to connect the debugger using Debug As: Connect JPDA to Application.launch
and I get the error message:
"Failed to connect to remote VM. Connection refused.
Connection refused: connect"
Any idea how to make this work?
As stated in another answer, the error you are getting is exactly the same one that you get when you attempt to connect the debugger for a second time when it is actually already connected.
That being said, if it doesn't seem to explain your case, look for this line when you initially start the application via Run As --> Application.launch:
Listening for transport dt_socket at address: 8000
It tells you on which port it is listening for possible JPDA connections, and if this line is missing then something is wrong. You can modify the Application.launch configuration manually (look at the address part of -Xrunjdwp parameter passed to Java virtual machine) and change the port if necessary. If you make changes you also need to update the Connect JPDA to Application.launch run configuration.
Anyways, that is my suggestion - check that the application is indeed listening for possible debugger connections, and try changing the port that is being used for the purpose.
Check that your application mode is set to dev in your conf/application.conf:
application.mode=dev
Start your application and you should see the following:
Listening for transport dt_socket at address: 8000
Right click on the "Connect JPDA.." launcher and Debug As "Connect JPDA..."
I have recieved this error in the past when i have forgotten that the debugger was already connected. Perhaps it is being launched in another way? Also is it possible that debugging is disabled in the app.conf? Just a few things I would check on.
I always run from the command line and debug from Eclipse, might be worth a tray as well. Also try running in test mode if you aren't.
Shutdown everything and run it again. What happens is that when you execute the debug it does not show you anything and you might think nothing happens. You get this error because you might tried several times and you don't know it is already running.
Firstly you have to start play from console not run as. Then start debugger run as.