Debugging Play with Eclipse - 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.

Related

Eclipse, Error showing : Apache Tomcat - Port has been used already, How to get rid of this without Restarting the PC?

Usually, the server gets stuck suddenly. After that server's start or stop option doesn't show up.
And already port has been used error showing.
And PC need to be restarted to get rid of this.
There should be a way to stop this without restarting the PC.
If you guys have the solution please guide me.
Thank You.
Identify which program is using port to which "Apache Tomcat" is trying to connect.
Ither stop that process or use diffrent port for "Apache Tomcat".
use netstat from cmd get the pid related to the port no.
From task manager goto the process related to pid and kill it.

Play 1.2.4.3: How to find currently used port for debugger?

I have several Play applications running parallel. One of them is running in Eclipse. I want to connect the Eclipse debugger (launcher "Connect JPDA to myapplication.launch"), but the port changes every time (probably due to one of the other applications blocking the default port). I would edit the launcher and enter the current port manually*, but: How would I know which port to use?
PS: As my app runs for quite a while I do not see the port initially displayed in the console anymore.
*PPS: Is there a more elegant way to handle this?
The more elegant way of handling this is to just define the jpda port it should use yourself, so you always know behind which jpda port an application is running and you don't have to look it up all the time. Its documented in the configuration manual and it comes down to adding jpda.port=???? in your application.conf (changing the question marks into a port number, ofcourse).
The reason they change is indeed because they are running in parallel. Java automatically switches to the next available port if the default is in use.
There should be a line in the output log that looks like the following:
Listening for transport dt_socket at address: <some port number>
That's the debug port number you need to configure in Eclipse for JPDA.
OK, in OS X you'll find the port in the activity monitor: Double click each "java" process until you find the one belonging to Eclipse. The requested port is the one mapped to "*".
Click here for details (in German) and screenshots (I need 10 reputation to post images or more than two links)

Remote Debugging Fails with IntelliJ but works with 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.

Netbeans & Eclipse hang when I attempt remote EC2 debugging via Xdebug

Already, I've checked at least 20 resources and am out of ideas:
I have a clean, remote Ubuntu EC2 instance, fresh from the AMI, having stopped only to install LAMP, phpmyadmin, and xdebug on it. Yes, I have configured my remote EC2 instance's php.ini file as follows:
Meanwhile, back on my laptop I have Netbeans & Eclipse installed. While I can get either to seamlessly upload and Run my php web app on my EC2 site (via SSH/SFTP) as soon as I hit "Debug" from either, index.php gets uploaded, a browser window opens, and then NOTHING HAPPENS. The page doesn't load, the Debug perspective doesn't open, breakpoints don't get triggered, nothing. Netbeans just hangs out saying "waiting for connection" whereas Eclipse just sits at the notorious 57% level (& yes, I toggled the xdebug.idekey before testing with Eclipse)).
So I tested xdebug's functionality on my server according to the instructions found here and here (both passed). I tried changing to port 9001 (in remote php.ini as well as in local Netbeans/Eclipse), I even tried launching this brand spanking-new EC2 instance with pretty much open Security group settings (SSH=0.0.0.0/0), but nothing seems to be working. I am out & out flummoxed, a self-confessed noob, and appreciative of any insight seasoned professionals in the community may have to offer.
Thanks,
Debbie
This feels like a networking issue to me. Port 9000 may not be accessible. The quickest way to test is to telnet to port 9000 on the remote system (if you have a telnet client installed that allows you to specify which port to telnet to). If the telnet attempt times out or is closed by the remote system you will see the error and this verifies that there is a networking issue.
I would check /etc/services to make sure that port 9000 is not reserved for use of something else. If port 9000 exists and is uncommented then something else is using the port and that services does not know how to respond to your request so it hangs.
I would do a netstat (lookup params to see "all" listening ports) and make sure the remote system is listening on port 9000. If you don't see port 9000 then the remote system is not configured to establish the connection.
If you are on a WIFI network then port 9000 may need to be port forwarded to the remote system using the internal cable modem configuration menu/utility. This is the scenerio I favor because I've wasted so much time solving this kind of problem with different software.
Good luck, you have more troubleshooting ahead of you and different questions to ask to resolve your problem.

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.