简体   繁体   中英

Java Remote debugging does not work in Jetty

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?

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"), ie 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM