Application server debugging: set jpda mode?
I am looking to debug a local copy of a tomEE server.
JPDA has two modes: either the app server listens for an incoming JDWP connection from the debugger and the debugger initiates the connection, or the debugger listens for the connection and the app server initiates it.
It appears that the IDEA configuration for a local tomEE server starts both the debugger and the app server in "listen" mode. So the only way to debug is to start the app server in "debug" mode and then immediately select run/attach-to-local-process.
This works OK, but it would be nice to avoid the extra step.
How can I configure the tomEE application server under IDEA to start either the debugger or the app server in "actively connect" mode so they don't each sit there waiting for the other to connect. I can't find anything under settings/Debugger or in the server configuration dialog to select this.
Please sign in to leave a comment.
Update: First of all, ensure that you are launching the run configuration in debug mode, your server output seems to be for the Run mode.
If this does not help, my original answer below still holds:
As far as I see, you are trying to debug the application deployed outside of IDEA directly to `<tomEE>/webapps/dojo.war`.
While this use case is also supposed to work, it is not an intended way of using of the local TomEE run configuration. I have submitted https://youtrack.jetbrains.com/issue/IDEA-188053 for your case. In the meanwhile I would suggest to switch to intended way:
If this still does not help, please attach (better to use in https://youtrack.jetbrains.com/issue/IDEA-188053 for further discussion)
Hope that helps,
There should be no extra steps needed. Make sure you are using the default TomEE Local Run/Debug Configuration. The relevant options are located under Startup/Connection tab for Debug mode:
These options are also printed in Console tab when you start the server. What do you have there?
My settings look like that, too. The part you have outlined in red - shows "server=n". I believe that means that instead of listening for connections from a debugger, that Tomcat is going to try to contact the debugger on port 58458, right? Where do I configure the debugger to listen on that port?
When I try to start the server in debug mode, I get an error like this:
Unable to open debugger port (127.0.0.1:58458): java.net.SocketException "Socket closed"
>Tomcat is going to try to contact the debugger on port 58458, right? Where do I configure the debugger to listen on that port?
It is configured in the same dialog:
>Unable to open debugger port (127.0.0.1:58458): java.net.SocketException "Socket closed"
Something is preventing IDEA to open the socket on the specified port. Check that the port is not already occupied by another process, try using different port. Try restarting the pc. If you have antivirus/firewall try with it disabled or make sure that IDE settings directories, IDE process, installation home and project files are excluded from the scan. Check that you are using the default configuration or of you are modifying JAVA_OPTS that they are correctly set. Check also this SO thread for possible reasons.
If issue remains, post complete textual output from Console tab when you start Run/Debug Configuration.
I have resolved the port in use problem. Stale processes were hanging around. At this point the tomEE server and the debugger both start; the debugger displays "Listening to port 58458", but the breakpoints don't seem to have any effect.
Please attach screenshots of Run/Debug Configuration Server tab and Startup/Connection tab with Debug mode selected and full textual output from Server tab when you launch configuration.
Server tab output: