一、storm任务远程调试
1. 在yaml文件中添加配置,其中address是要使用的远程机器的端口号
topology.debug: true
topology.worker.childopts: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
2.提交任务并发布
3.在idea中,依次点击run、edit configurations,点击+选择remote,输入name、command line、host、port和search sources using module‘s classpath,host是任务运行的worker的ip,port与yaml中一致。最后点击apply。
二、tomcat远程调试
2.1 配置debug configuration,点击下拉三角,选择edit configuration。点击+,选择remote,在name中输入调试名,选择debugger mode,设置localhost和port,点击ok保存。
2.2 修改tomcat调试端口
vim /path/to/tomcat/bin/catalina.sh,修改JPDA_ADDRESS为刚才设定的端口,这里是5005,然后保持。
2.3 启动tomcat远程调试端口
sh catalina.sh jpda start
在postman中模拟请求,在代码中添加断点调试。