Java Eclipse 在调试模式下不会在断点处停止

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24693603/
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-14 14:10:07  来源:igfitidea点击:

Eclipse doesn't stop in break points in debug mode

javaeclipsedebuggingbreakpoints

提问by Majico

Since yesterday I have problem with Eclipse debugger becasue it doesn't stop in the break points. I searched and I've found out this issue was an old problem related to the JDK 1.6.0_14, but I use JDK 1.7.0_55 and it was working good but from yesterday, to make it work, I should clean application and restart the PC and then run it in debugger and if I do any changes in my code then I should clean and restart the pc again, becuase it doesn't work and I don't know what happened. I use windows 8, Eclipse Kepler Service Release 2 and Oracle Weblogic. Thanks for your help

从昨天开始,我遇到了 Eclipse 调试器的问题,因为它不会在断点处停止。我搜索了一下,发现这个问题是一个与 JDK 1.6.0_14 相关的老问题,但我使用的是 JDK 1.7.0_55,它运行良好,但从昨天开始,为了使其正常工作,我应该清理应用程序并重新启动PC,然后在调试器中运行它,如果我对代码进行了任何更改,那么我应该清理并重新启动 PC,因为它不起作用,我不知道发生了什么。我使用 Windows 8、Eclipse Kepler Service Release 2 和 Oracle Weblogic。谢谢你的帮助

采纳答案by kiwiron

If you are using Maven, this is often due to the local source being for a different version than you the executable you are trying to debug. For instance:

如果您使用 Maven,这通常是由于本地源与您尝试调试的可执行文件的版本不同。例如:

  • I develop v1.0.34-SNAPSHOT and commit to our SVN repository.
  • The CI server automatically compiles this version
  • I use the CI server to release version 1.0.34
  • I deploy v1.0.34 to say Weblogic
  • I try to debug, and Eclipse gets confused - it has source for 1.0.34-SNAPSHOT but the running version is 1.0.34
  • 我开发了 v1.0.34-SNAPSHOT 并提交到我们的 SVN 存储库。
  • CI服务器自动编译这个版本
  • 我使用 CI 服务器发布 1.0.34 版本
  • 我部署 v1.0.34 说 Weblogic
  • 我尝试调试,但 Eclipse 感到困惑 - 它有 1.0.34-SNAPSHOT 的源代码,但运行版本是 1.0.34

Another problem I have seen in older Eclipse versions, is that if two projects import different versions of the same library, then the debugger gets confused as to which source it should use. I've not tested this on Kepler or Luna.

我在旧 Eclipse 版本中看到的另一个问题是,如果两个项目导入同一个库的不同版本,那么调试器会混淆它应该使用哪个源。我没有在 Kepler 或 Luna 上测试过这个。

回答by sumit kumar

After setting break pointyou need to run the program in debugging mode

设置break point好后需要运行程序debugging mode

If you will run it normally it will not stop at break points.

如果您将正常运行它,它将不会在break points.

回答by kunwar.sangram

For debugging Java APPfrom eclipse, Run application/programming in debugging mode. For remote debugging, add debugging option to java process and connect to it using Eclipse remote debugging options.

Java APP要从 Eclipse进行调试,请在调试模式下运行应用程序/编程。对于远程调试,将调试选项添加到 java 进程并使用 Eclipse 远程调试选项连接到它。

Plus if you have changed your code and applied breakpoints, then needless to say you need to rebuild your project.

另外,如果您更改了代码并应用了breakpoints,那么不用说您需要重建您的项目。

And breakpointshould be reachable in code flow.

并且breakpoint应该可以在代码流中访问。

回答by Francisco Corrales Morales

This is what works for me:

这对我有用:

I had to put my local server address in the PHP Serverconfiguration like this:

我不得不将我的本地服务器地址放在PHP 服务器配置中,如下所示:

enter image description here

在此处输入图片说明

Note: that address, is the one I configure in my Apache .conffile.

注意:该地址是我在 Apache .conf文件中配置的地址。

Note: the only breakpoint that was working was the 'Break at first line', after that, the breakpoints didn't work.

注意:唯一有效的断点是“在第一行中断”,之后断点不起作用。

Note: check your xdebugproperties in your php.inifile, and remove any you think is not required.

注意:检查php.ini文件中的xdebug属性,并删除您认为不需要的任何属性。

回答by Andres

I had this happen to me, and it took me a while (embarrassingly too long) to work out what I had done.

我遇到了这种情况,我花了一段时间(令人尴尬的太久)才弄清楚我做了什么。

I run multiple jboss servers, and after upgrading Eclipse I configured my project debug to point at the socket of the wrong server ... so when hitting debug I could see the running threads, but unfortunately it was the other server.

我运行多个 jboss 服务器,在升级 Eclipse 后,我将我的项目调试配置为指向错误服务器的套接字......所以当点击调试时我可以看到正在运行的线程,但不幸的是它是另一台服务器。

Hopefully this may save some one the 30 minutes it to me to work it out.

希望这可以为我节省 30 分钟的时间来解决它。

回答by Maverick

Make sure you didn't click skip break pointoption in eclipse. I did and wasted 45 minutes in figuring it out...

确保您没有skip break point在 Eclipse 中单击选项。我做了并浪费了 45 分钟来弄清楚......

回答by Hemant Nagpal

I had the same problem but with a little different scenario.

我遇到了同样的问题,但场景略有不同。

I was building the project using maven and deploying it through eclipse by adding the project in the server (right click on server and choosing "add and remove") and starting it (in debug mode only). It was not stopping on debug points.

我正在使用 maven 构建项目并通过 Eclipse 部署它,方法是在服务器中添加项目(右键单击服务器并选择“添加和删除”)并启动它(仅在调试模式下)。它并没有停在调试点上。

I then removed the project from eclipse server and copied the war generated from maven build to the webapp folder in tomcat (or any other server). This time it will stop on the debug point and will ask for the source to look out. Just click the source button , and point it out to the eclipse project. You are good to go. It will behave as expected.

然后我从 eclipse 服务器中删除了该项目,并将 maven build 生成的 war 复制到 tomcat(或任何其他服务器)中的 webapp 文件夹中。这一次它会停在调试点上,并会要求源看看。只需单击源按钮 ,并将其指向 eclipse 项目。你已准备好出发。它将按预期运行。

回答by secret admirer

So I wanted to share this because I didn't really find this answer anywhere else. I don't know what is special about my configuration, but none of the obvious things above were solving it. Skip breakpoints was not checked, I was running in debug mode, etc.

所以我想分享这个,因为我在其他任何地方都没有真正找到这个答案。我不知道我的配置有什么特别之处,但上述显而易见的事情都没有解决它。未检查跳过断点,我在调试模式下运行等。

What did happen, I suspect could possibly be an eclipse bug? I don't really know. But when you go into the default debug perspective, there are a bunch of panels open. (I don't know if panels is the correct term.) I'm a big minimizer of panels that I'm not using. One of the panels in debug perspective has the "Debug" view (note the difference between a perspective and a view.) I didn't need to be using that view, or any of the other views typical to that panel, so I had it minimized to the small toolbar on the side of the screen.

发生了什么,我怀疑可能是日食错误?我真的不知道。但是当您进入默认调试透视图时,会打开一堆面板。(我不知道面板是不是正确的术语。)我是我没有使用的面板的最小化者。调试透视图中的面板之一具有“调试”视图(请注意透视图和视图之间的区别。)我不需要使用该视图或该面板的任何其他典型视图,所以我有它最小化到屏幕一侧的小工具栏。

As soon as I expanded that panel with the Debug view, bang, breakpoint hit. I'm not doing any extensive testing to see what exact combination of things can result in that, just wanted to mention that maybe you should add it to your checklist of things that might cause this.

一旦我使用调试视图扩展该面板,砰,断点命中。我没有进行任何广泛的测试来查看哪些确切的事物组合会导致这种情况,只是想提一下,也许您应该将其添加到可能导致这种情况的事物清单中。

Feels nice to contribute, hope this helps someone one day! Have a good day, dinglehoppers!

感觉很高兴做出贡献,希望有一天这可以帮助某人!祝你有美好的一天,小叮当!

回答by Umesh Kumar Sharma

Make sure Tomcat is down. Then right click on project follow the screen shot.

确保 Tomcat 已关闭。然后右键单击项目按照屏幕截图。

enter image description here

在此处输入图片说明

In the Commontab, select Debugoption. And then start server in debug mode. It will work like a charm.

Common选项卡中,选择Debug选项。然后以调试模式启动服务器。它会像魅力一样发挥作用。

回答by saurabh kumar

This happened to me when I was debugging a remote java application. After trying to figure out what was really happening for an hour I was able to find out that there was a build difference that was deployed on tomcat server and code I have been enabling debug points. I hope it helps!

当我调试远程 Java 应用程序时,这发生在我身上。在试图弄清楚真正发生了什么一个小时后,我发现部署在 tomcat 服务器上的构建差异和我一直在启用调试点的代码。我希望它有帮助!