(1) start Jetty server under debug mode via mvn jetty:run
![](https://img.haomeiwen.com/i2085791/84e635441a1f0f3a.png)
(2) In Eclipse, create a new Debug configuration->Remote Java Application
![](https://img.haomeiwen.com/i2085791/c6b3fd05c023a5d2.png)
Specify Host as localhost and port 8000:
![](https://img.haomeiwen.com/i2085791/427bd15aac56b6fb.png)
Click debug button:
![](https://img.haomeiwen.com/i2085791/d686b5cbac9bcae0.png)
You should observe that the Jetty server listening to port 8000 has accepted this debug request and start application via localhost:8080 now:
![](https://img.haomeiwen.com/i2085791/1b51999f491fea9d.png)
(3) go to localhost:8080, perform action to trigger the breakpoint:
![](https://img.haomeiwen.com/i2085791/039365878f8dac7b.png)
And now in Eclipse, breakpoint is triggered!
![](https://img.haomeiwen.com/i2085791/f2489cb65d81ca3f.png)
Note: if you meet with error message “bind error, address already in use”, please first use “netstat -lp” to find the process id which occupies the address and kill that process by kill -9 <pid>.
![](https://img.haomeiwen.com/i2085791/a28e08747b4af0ef.png)
![](https://img.haomeiwen.com/i2085791/8c9d79baba7b3567.png)
If still does not work, restart the virtual machine instance.
网友评论