jdb应用 远程调试

场景:

外网可以登录远程主机,但是因为安全限制,不能在外网直接访问docker应用的端口,因此不能远程调试。远程主机shell内部可以连接docker应用,也没有图形界面,没有log,考虑使用原始的jdb来调试

 

要求:应用启动时开启了debug模式

旧配置方式

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000

新配置方式

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000

 区别>> https://stackoverflow.com/questions/138511/what-are-java-command-line-options-to-set-to-allow-jvm-to-be-remotely-debugged

 

jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=8000

 

 参考:

JPDA: Java Platform Debugger Architecture

jdwpJava Debug Wire Protocol 

 

posted @ 2018-06-30 22:56  funny_coding  阅读(356)  评论(0编辑  收藏  举报
build beautiful things, share happiness