[英]How do I debug a Java app running in a Docker container in IntelliJ IDEA 2018.2?
I have a Java app that I'm attempting to debug inside of (because a particular error only happens when the app is run from inside Docker
, which is fun ), but I can't figure out how to get IntelliJ to attach for debugging. 我有一个Java应用程序正在尝试在其中调试(因为只有在Docker
内部运行该应用程序时才会发生特定错误,这很有趣 ),但是我不知道如何让IntelliJ附加进行调试。
I have the Docker Integration plugin installed, but when I go to run my container, the deploy log has a line that says Cannot retrieve debug connection: Debug port not specified
. 我已经安装了Docker Integration插件,但是当我运行容器时,部署日志中有一行显示“ Cannot retrieve debug connection: Debug port not specified
。 Google told me that I needed to add a debugPort
entry to my workspace.xml
file, but when I did that , my Run/Debug configuration complained that "Debug port forwarding not found". 谷歌告诉我,我需要一个添加debugPort
进入到我的workspace.xml
文件,但是当我这样做,我运行/调试配置抱怨说,“调试端口转发未找到”。 Clicking "Fix" resulted in a container_settings.json
file being created, which IntelliJ immediately informed me wasn't supported in 2017.3+, and that i should use command line options instead. 单击“修复”导致创建了container_settings.json
文件,IntelliJ立即通知我在2017.3+中不支持该文件,我应该使用命令行选项。 However, I have no idea what those command line options should be. 但是,我不知道这些命令行选项应该是什么。
When I tried specifying the forwarding port in the Run/Debug configuration, the deploy log ended with Cannot retrieve debug connection: java.net.MalformedURLException: unknown protocol: unix
, which makes no freaking sense. 当我尝试在“运行/调试”配置中指定转发端口时,部署日志以Cannot retrieve debug connection: java.net.MalformedURLException: unknown protocol: unix
结尾Cannot retrieve debug connection: java.net.MalformedURLException: unknown protocol: unix
,这没有什么奇怪的意义。
Help! 救命!
You can even use dcevm / HotswapAgent in dockerized application and modify code/resorces without restart. 您甚至可以在dockerized应用程序中使用dcevm / HotswapAgent并修改代码/资源,而无需重新启动。 Look at this project https://github.com/HotswapProjects/hotswap-docklands 看看这个项目https://github.com/HotswapProjects/hotswap-docklands
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.