Reputation: 125
I'm trying to debug a remote Java application in Eclipse that runs on a Tomcat server. I keep running into one of two errors depending on how my debugging is set up. I am not using any proxy or VPN, all the code is run on my own machine.
I cannot show a lot of code, but I can describe exactly the steps I took:
First, I changed the code in startup.bat
located in the bin directory of Tomcat:
call "%EXECUTABLE%" start %CMD_LINE_ARGS%
changed to call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
Just above this line, I added the following JVM parameters. I have no idea what parameters they are supposed to be nor do I know if this is the right place to put them, but I just followed one example:
set JAVA_OPTIONS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
On Eclipse, here is the port configuration I have for the server:
Tomcat Admin port: 8005
HTTP/1.1: 8080
SSL: 8443
AJP/1.3: 8009
After making sure the server is running without errors, I then opened run->debug configuration->remote Java application and set these parameters, and then hit Debug:
Host:localhost
Port:8000
Doing so results with a "connection refused" error. When I change the port number in the debug configuration to 8080 or 8005, then the startup waits for 20 seconds, and then returns a "connection timeout" error. When I increase the timeout to 3 minutes, then the startup waits for 3 minutes, and then returns a "connection timeout" error. Changing the "address" in the JVM settings does not seem to make any difference, no matter if its set to 8005 or 8080.
Do you have any suggestions of things I could try to look into? Thanks, Nathan
Upvotes: 3
Views: 1692
Reputation: 333
I think you dont have to modify anything coming out of the box. if you want to start your tomcat in debug mode then from the bin folder run "./catalina.sh jpda start" if running in mac or linux or run "catalina jpda start",
this will start tomcat in debug mode and then you can try connecting your debugger to port 8000.
Upvotes: 1