Debug points not working in eclipse for a remote application - eclipse

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>

Related

Wildfly stops when running in debug mode in Eclipse

I installed Eclipse and the Jboss Tools plugin with Wildfly.
I can run Wildfly in Eclipse in non-debug mode with no problems. But when I start Wildfly in debug, I can use it for a few minutes, and then it suddenly stops processing, the server ends.
I checked the log and there's nothing. What could be wrong?
Please note the JBoss Tools 4.9.0 is validated against 2018-09 but not against 2018-12.
Do you see something in the server log when the server dies ?
We had this issue and it was because we changed our config to close the management port, which had been used to detect that the server had started. Eclipse could no longer detect that the server had started, so it shut down the process after a set time (450 seconds)
To resolve the issue, we did the following in the Eclipse's Overview panel for our JBoss Server:
Changed the Start Timeout to 30, so it would only fail if it actually couldn't start in 30 seconds rather than waiting for 450
Changed our "Server State Detectors" to detect a Web Port for Startup Poller and Process Terminated for Shutdown Poller.
Changed the Server Ports to match our new configuration
Excerpt from JBoss Community Archive
The tooling was unable to verify your server started. Our tooling has several methods to see if your server is up or not. The two most-often used methods are either "Web Port Poller" or "Management Poller".
You can see which your server is using by opening the server object (In Servers view, double-click your server) and on the right side you'll see a section on polling.
If your server adapter (fancy word for the tooling's representation of your server) is using the Management Port Poller, you should make sure your server is actually exposing the management port. For local servers this shouldn't be an issue, since local servers should automatically expose the management port. You may want to verify in the Ports section (also in the server editor) that the management port is correct. To check if the server is up, we run a management command against the server. If the server responds properly, we declare the server to be started.
If you're using the web port poller, then you may want to verify your web port is correct. To verify the server is up, the Web Port Poller opens a URL connection on {serverHost}:{webPort} and sees if we get a valid connection.

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.

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.

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.

Can't run a Servlet with Tomcat because something is using the ports

I'm trying to write a Servlet in eclipse configured to use Tomcat 5.5 and I get the following error when I try to run it:
Several ports (8080, 8009) required by Tomcat v5.5 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s)
As far as I know, Tomcat 5.5 is the one using port 8080, and when I go to http://localhost:8080 I do get the Tomcat success page, so it looks like eclipse tries to run another instance of Tomcat without shutting down the original and fails. How do I solve this?
like it says, something is using the port.
there are two solutions for your problem.
identify (on windows with netstat command) what is using the port (e.g. skype, ...) and stop it
change the port of your tomcat runtime in eclipse -> http://techteam.wordpress.com/2009/02/13/changing-the-tomcat-port-settings-in-eclipse/
hope this helps