0
votes

I am using Jetty 8 and trying to connect from Eclipse. I am using Java 1.6.
While starting jetty in debug mode, I am giving the below command which throws an "Address already in Use" error.

java -Xdebug -agentlib:jdwp=transport=dt_socket,address=8080,server=y,suspend=n -jar start.jar.  

To do Remote debugging, I need open the debug mode on the same port in which Jetty server which is going to run.
The reason I suspect is, I am opening a debug port on 8080(done successfully) and when Jetty tries to start the server in default port 8080, it throws the error "Address already in use".

Can you help me?

1
why don't you then try a different port for the debugger, e.g. 7999? - wero

1 Answers

0
votes

Yes, the JVM allocates the port you specify for debugging, and it is unavailable for Jetty later. Unless explicitly coded, ports cannot be shared between purposes.

You should use another unused port for either of your purposes. I would suggest using 8000 or 7999 for the debugger port.

Note that modern versions of Eclipse allows for the reverse configuration ("listen"), i.e. that Eclipse listens on the port given and the JVM connects back to it. This might be relevant if you are debugging across a restricted network.