Java Intellij 调试器不会在断点处停止

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30088083/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 09:06:28  来源:igfitidea点击:

Intellij debugger does not stop at breakpoints

javaintellij-ideamaven-3weblogic12c

提问by datta

I must be doing something wrong here. I am new to intellij. Making switch from eclipse. I have a JAX WS application that runs on weblogic. The artifact to deploy is an ear file. I have been struggling to get debugger on intellij working. I have the ultimate edition. I did create a run debug configuration but it just passes through the code and does not stop at my desired location. The debugger shows a red dot without a check or a cross.

我一定在这里做错了什么。我是intellij的新手。从 eclipse 切换。我有一个在 weblogic 上运行的 JAX WS 应用程序。要部署的工件是一个ear 文件。我一直在努力让调试器在 intellij 上工作。我有终极版。我确实创建了一个运行调试配置,但它只是通过代码并且不会在我想要的位置停止。调试器显示一个没有检查或交叉的红点。

Edit- I am running a "local" run/debug configuration.

编辑- 我正在运行“本地”运行/调试配置。

Here is a screen shot of my run/debug configuration.

这是我的运行/调试配置的屏幕截图。

enter image description here

在此处输入图片说明

Here is the screen shot of startup/Connection

这是启动/连接的屏幕截图

enter image description here

在此处输入图片说明

采纳答案by datta

I figured out what my issue was and I think the problem is specific to me and the nature of my application. Actually I should call it a self induced issue. Let me explain the nature of events.

我弄清楚了我的问题是什么,并且我认为这个问题特定于我和我的应用程序的性质。其实我应该称之为自我诱导的问题。让我解释一下事件的性质。

  1. I have been using eclipse to develop and have a local install of weblogic instance. My application needs coherence cache server and I have few other JVM parameters that I pass when starting the domain. Therefore I had added a line at the start of the $DOMAIN_HOME/bin/setDomainEnv.shfile like so

    JAVA_OPTIONS="- Dtangosol.coherence.distributed.localstorage=false -Dtangosol.coherence.wka=devmachine and blah blah blah

  2. I switched to intellij and started working on this project and then configured the weblogic plugin and run configuration etc.

  3. I noticed that intellij adds a JAVA_OPTIONS in the startup/connectiontab in Run/Debug Configurationslike so
  1. 我一直在使用 eclipse 开发并在本地安装了 weblogic 实例。我的应用程序需要一致性缓存服务器,并且我在启动域时传递的其他 JVM 参数很少。因此我在$DOMAIN_HOME/bin/setDomainEnv.sh文件的开头添加了一行,就像这样

    JAVA_OPTIONS="- Dtangosol.coherence.distributed.localstorage=false -Dtangosol.coherence.wka=devmachine and blah blah blah

  2. 我切换到 Intellij 并开始处理这个项目,然后配置了 weblogic 插件并运行配置等。

  3. 我注意到 intellij在运行/调试配置启动/连接选项卡中添加了一个 JAVA_OPTIONS像这样

enter image description here

在此处输入图片说明

  1. However the JAVA_OPTIONS that was being passed by intellij was not being used by weblogic. I believe it was overridden with what was in the setDomainEnv.sh which is why I saw the following logs.
  1. 然而,intellij 传递的 JAVA_OPTIONS 没有被 weblogic 使用。我相信它被 setDomainEnv.sh 中的内容覆盖了,这就是我看到以下日志的原因。

java version "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode) Starting WLS with line: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -client -Xms512m -Xmx512m -XX:MaxPermSize=256m -Dweblogic.Name=AdminServer -Djava.security.policy=/Users/dparupud/omw/oracle/middleware/weblogic_10.3.6/wlserver_10.3/server/lib/weblogic.policy -Dtangosol.coherence.distributed.localstorage=false -Dtangosol.coherence.wka=devmachine blah blah blah......

java version "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode) Starting WLS with line: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -client -Xms512m -Xmx512m -XX:MaxPermSize=256m -Dweblogic.Name=AdminServer -Djava.security.policy=/Users/dparupud/omw/oracle/middleware/weblogic_10.3.6/wlserver_10.3/server/lib/weblogic.policy -Dtangosol.coherence.distributed.localstorage=false -Dtangosol.coherence.wka=devmachine blah blah blah......

  1. When I went and removed the JAVA_OPTIONS from setDomainEnv.sh and restarted the server from intellij I saw the following log
  1. 当我从 setDomainEnv.sh 中删除 JAVA_OPTIONS 并从 intellij 重新启动服务器时,我看到了以下日志

starting weblogic with Java version: java version "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode) Starting WLS with line: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -client -Xms512m -Xmx512m -XX:MaxPermSize=256m -Dweblogic.Name=AdminServer -Djava.security.policy=/Users/dparupud/omw/oracle/middleware/weblogic_10.3.6/wlserver_10.3/server/lib/weblogic.policy -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:65501,suspend=y,server=n

starting weblogic with Java version: java version "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode) Starting WLS with line: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -client -Xms512m -Xmx512m -XX:MaxPermSize=256m -Dweblogic.Name=AdminServer -Djava.security.policy=/Users/dparupud/omw/oracle/middleware/weblogic_10.3.6/wlserver_10.3/server/lib/weblogic.policy -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:65501,suspend=y,server=n

Now the log showed that the jdwp agent was in action. I did notice that I did not see that particular log before I asked the Question on SO but I thought maybe IntelliJ was doing something inside the covers because JAVA_OPTIONS was being passed and intellij does not allow you to mess with that ( it is readonly).

现在日志显示 jdwp 代理正在运行。我确实注意到在我问 SO 问题之前我没有看到那个特定的日志,但我想也许 IntelliJ 正在做一些事情,因为 JAVA_OPTIONS 被传递了,intellij 不允许你弄乱它(它是只读的)。

I guess I can either pass all my jvm parameters either from intellij or add the jdwp agent info in the setDomainEnv.sh.

我想我可以从 intellij 传递我所有的 jvm 参数,也可以在 setDomainEnv.sh 中添加 jdwp 代理信息。

Now I am able to debug.

现在我可以调试了。

回答by 8bitme

To setup WebLogic debugging on IntelliJ:

在 IntelliJ 上设置 WebLogic 调试:

  1. Find the WebLogic Debug Port:this is the port on WebLogic exposed for debugging. The default debug port is 8453 but if it was changed you can find it in the config.xml (under the config folder in your domain home) or the setDomainEnv.sh look for DEBUG_PORT (I assume it is .sh and not .bat as you appear to be using Mac OS X).

  2. Remote Debugger Configuration:go to the configuration and choose new, then select "Remote" ,type in any name that is sensible and under the port (orange block in image) type in the value you found in 1. For host (the green block) type localhost [a side note: you can connect to a remote server by typing that servers host name or IP if the debug port is exposed].

  3. Start debugger:Start the debug configuration you just setup, the debug window will pop up and if the port is correct it will say it has connected to remote host and you are good to go debugging.
  1. 找到 WebLogic 调试端口:这是 WebLogic 上为调试公开的端口。默认调试端口是 8453,但如果它被更改,您可以在 config.xml(在域主目录的 config 文件夹下)或 setDomainEnv.sh 中查找 DEBUG_PORT(我假设它是 .sh 而不是 .bat)您似乎正在使用 Mac OS X)。

  2. 远程调试器配置:转到配置并选择新建,然后选择“远程”,输入任何合理的名称,并在端口(图像中的橙色块)下输入您在 1. 对于主机(绿色块)中找到的值) 键入 localhost [旁注:如果调试端口已公开,您可以通过键入服务器主机名或 IP 来连接到远程服务器]。

  3. 启动调试器:启动你刚刚设置的调试配置,会弹出调试窗口,如果端口正确,它会说它已经连接到远程主机,你就可以开始调试了。

IntelliJ remote Debugger

IntelliJ 远程调试器

--Edit 1--

--编辑1--

Read your question again missed the part about you already having setup the remote config.

再次阅读您的问题,错过了关于您已经设置远程配置的部分。

It may be missing the breakpoint if your program is multi-threaded the breakpoint may not be hit on the current thread you are on.

如果您的程序是多线程的,则可能会丢失断点,断点可能不会在您所在的当前线程上命中。

There is a drop down in the debugger when you have the remote configuration working where you should be able to select the thread to debug on.

当远程配置工作时,调试器中有一个下拉菜单,您应该能够选择要调试的线程。

-- Edit 2 --

-- 编辑 2 --

Added the image for the remote debugger settings

添加了远程调试器设置的图像

回答by Mukundhan

Deleting the configuration and creating a new one solved it for me.

删除配置并创建一个新配置为我解决了这个问题。