Eclipse裸奔調試WebLogic

來源:互聯網
上載者:User

項目開發的時候能做斷點就最好啦~而eclipse在這點上是比不上myeclipse的
那麼是不是說我們就不能斷點了呢?現在的項目裡同事用到了斷點我就理所當然也要用啦`在設定的過程中發現一些問題記錄下來!

步驟:
1. 用編譯器開啟weblogic項目目錄下的startWebLogic.cmd ,在裡面加上這句:
set JAVA_OPTIONS=%JAVA_OPTIONS% -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8888,server=y,suspend=n

2.在eclipse裡面
項目名上右鍵-DeBug As-DeBug configurations...-選擇Remote Java Application下你的項目-設定connect Properties下為: localhost 8888,這個port對應的是上面的address.

3.啟動伺服器,在項目名上右鍵Debug As-DeBug configurations...-點擊DeBug按鈕!
然後理論上是可以斷點的了!

PS:可是我這裡報錯:
"Unable to install breakpoint due to missing line number attributes,Modify compiler options to generate line number attributes"

遇到這個錯誤時找到的解答方案匯總:
1、使用Ant編譯時間,未開啟debug開關,在寫javac 任務時確認debug=true,否則不能調試。THe settings for the eclipse compiler don't affect the ant build and even if you launch the ant build from within eclipse. ant controls it's own compiler settings.you can tell ant to generate debugging info like this 'javac ... debug="true".../>
2、編譯器的設定問題,window->preferences->java->Compiler在compiler起始頁,classfile Generation地區中確認已經勾選了All line number attributes to generated class files。如果已經勾選,從新來一下再Apply一下。或者從項目層次進行設定,項目屬性->java compiler同樣在起始頁,確定已經勾選
Eclipse報的這個錯,無非就這兩個原因造成的

第一點是eclipse預設的,不需要怎麼改!第二點就是ant部署的時候編譯java檔案沒有debug="true"的屬性!
加上後重新編譯部署啟動伺服器,點擊debug,運行項目,就可以正常斷點調試了!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.