eclipse下通過jetty遠端偵錯Java應用__Java

來源:互聯網
上載者:User

1.啟動jetty server

2.在eclipse中右鍵項目:

Debug As->Debug Configurations 在左邊選中Remote java Application下的New_configuration,修改name和port,如下圖(這個相當於.net中的附加進程)

報這個錯誤:Failed to connect to remote VM. Connection refused.
Connection refused: connect

解決方案:(先檢測jetty server 是否啟動成功了)

(1).增加環境變數MAVEN_OPTS: -Xdebug -Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=n 

(如果是tomcat則需要找到tomcat/bin/catalina.bat檔案,編輯,在CATALINA_OPTS之前加上下行代碼

set CATALINA_OPTS=-server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=50001【用來調試的連接埠號碼】)

(2).另外一種原因是你已經在debug了,把原來的關了即可,紅框中的表徵圖點擊下即可

3.訪問調試的url地址,會進入斷點


this kind of launch is configured to open the debug perspective when it suspends 這個是詢問是否進入斷點,yes即可


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.