天天看點

tomcat9 開啟遠端調試

tomcat9 開啟遠端調試

    • 1、配置tomcat 9 (linux版 + idea)
    • 2、配置idea
    • 3、啟動遠端tomcat
    • 4、啟動idea 中的remote tomcat

1、配置tomcat 9 (linux版 + idea)

  • 在tomcat 的bin/catalina.sh 檔案中添加 export JPDA_ADDRESS=0.0.0.0:9000
# catalina.sh  檔案中的說明
# JPDA_ADDRESS (Optional) Java runtime options used when the "jpda start"
# command is executed. The default is localhost:8000.

export JPDA_ADDRESS=0.0.0.0:9000
           

2、配置idea

  • 新增remote tomcat
    tomcat9 開啟遠端調試
  • 配置remote tomcat ,配置tomcat 中的host 為伺服器的ip,port 為步驟1 中配置的端口:9000
    tomcat9 開啟遠端調試
  • 配置remote tomcat 中的debug 參數,位置為Startup/Connection->Debug->Port

    配置為步驟1 中配置的端口:9000

    tomcat9 開啟遠端調試

3、啟動遠端tomcat

  • 啟動指令為:
sh bin/catalina.sh jpda start
           

4、啟動idea 中的remote tomcat

  • 這時候需要用debug模式啟動tomcat,啟動期間會有連接配接不上的情況(tomcat9 還沒有加載好),多試幾次就好

繼續閱讀