简体   繁体   English

Eclipse跳过断点

[英]Eclipse skipping breakpoints

My issue isn't a new one, and I found several threads about it, yet no one was helpful for me. 我的问题不是新问题,我找到了几个关于它的线索,但没有人对我有帮助。 I hope this one will. 我希望这个会。

I can't debug with eclipse. 我不能用eclipse调试。 It recognizes breakpoints, switches to debug view, but somehow it gets out of sync and I can't debug my code. 它识别断点,切换到调试视图,但不知何故它不同步,我无法调试我的代码。 Sometimes It works, but after a while It happens again. 有时它有效,但过了一段时间又发生了。

I work with JDK 1.6.0_24, Glassfish 3.1, eclipse INDIGO (but it also happens on HELIOS). 我使用JDK 1.6.0_24,Glassfish 3.1,eclipse INDIGO(但它也发生在HELIOS上)。

I tried (as I found in this site) to set eclipse to use Parallel GC. 我尝试(正如我在本网站中找到的)设置eclipse以使用Parallel GC。 I tried put it in the eclipse.ini file, I tried to put in the glassfish VM arguments itself, and I tried to put it at eclipse JDK additional VM arguments (preference -> installed JRE-> JDK -> etc). 我试过把它放在eclipse.ini文件中,我试图把它放在glassfish VM参数中,我试着把它放在eclipse JDK的其他VM参数上(首选 - >安装JRE-> JDK - >等)。 Nothing seem to work for me. 似乎没有什么对我有用。 I also tried them all together. 我也一起试过它们。

Help me please.. 请帮帮我..

Thank you all from advance, Ido Ido,先谢谢大家



EDIT: 编辑:

OK, I noticed few more things: 好的,我注意到了更多的东西:

On the Debug view, in my stck trace, I found the exact class with the breakpoint is paused and it had this comment: "(Suspended breakpoint at line XX)". 在Debug视图中,在我的stck跟踪中,我发现断点的确切类被暂停,并且它有这个注释:“(XX处的暂停断点)”。 When I clicked the line, suddenly the green line appeared. 当我点击该线时,突然出现绿线。 Yet, as soon as I clicked F6 to continue, It went out of sync again, just the next line became suspended. 然而,一旦我点击F6继续,它再次失去同步,只是下一行被暂停。 Weird. 奇怪的。

I checked the processes running on my computer and found that there are several "java.exe" processes running at the same time. 我检查了计算机上运行的进程,发现有几个“java.exe”进程同时运行。 (eclipse runs on javaw.exe). (eclipse在javaw.exe上运行)。 Maybe this is why glassfish and eclipse refuse to work together. 也许这就是为什么glassfish和eclipse拒绝合作的原因。

I checked the build path and found that this is my output folder: project-name/target/classes. 我检查了构建路径,发现这是我的输出文件夹:project-name / target / classes。 Is this good? 这个好吗?

Any thoughts? 有什么想法吗?

Ido 我做

So, I couldn't fix this but I found a workaround that completely solves this - FINALLY!. 所以,我无法解决这个问题,但我找到了一个彻底解决这个问题的解决方法 - 最终!

I just stopped using glassfish WTP for debugging and set a remote debug to my local glassfish. 我刚停止使用glassfish WTP进行调试,并将远程调试设置为我当地的glassfish。 it works perfectly with few minor annoying things - but breakpoints finally noticed. 它完美地处理了一些令人烦恼的小事 - 但断点终于注意到了。

Set remote debug 设置远程调试

  1. Go to your glassfish admin console and set your glassfish to work on debug mode. 转到您的glassfish管理控制台并将您的glassfish设置为在调试模式下工作。
    Click on configuration --> server-config --> JVM settings, and check debug enabled check box. 单击配置 - > server-config - > JVM设置,然后选中启用调试复选框。
    Restart server 重启服务器

  2. In eclipse - start server on normal mode (not debug - it is useless). 在eclipse中 - 在正常模式下启动服务器(不调试 - 它没用)。

  3. Go to Debug configurations and locate "Remote Java Application" 转到调试配置并找到“远程Java应用程序”

  4. Create a new Remote java app debug config 创建一个新的远程Java应用程序调试配置

  5. Enter name (lets say Glassfish-Debug) 输入名称(比方说Glassfish-Debug)

  6. Choose project to debug 选择要调试的项目

  7. Enter your own IP address in the host section and set the port to 9009 在主机部分输入您自己的IP地址 ,并将端口设置为9009
    在此输入图像描述

  8. This is optional but it is more comfortable to work with: 这是可选的,但使用起来更舒服:
    Go to "Common" tab, and check the Debug check box. 转到“常用”选项卡,然后选中“调试”复选框。
    This will make this Glassfish remote debugging configuration constant on your debug menu. 这将使您的调试菜单上的Glassfish远程调试配置保持不变。
    在此输入图像描述

That's it. 而已。 Now all you have to do is always start your Glassfish in normal mode and then go to Debug configurations and run This Glassfish remote debugging you just set. 现在,您所要做的就是始终以正常模式启动Glassfish,然后转到Debug配置并运行您刚设置的This Glassfish远程调试。
在此输入图像描述

And now I'm getting to the annoying part: After rebuild your project, sometimes you might get again out of sync. 而现在我已经到了烦人的部分:重建项目后,有时候你可能会再次失去同步。 You just need to disconnect the remote debugging session and run it again. 您只需要断开远程调试会话并再次运行它。 Small price to pay. 付小的代价。

I hope it helps.. 我希望它有帮助..

I had faced similar issues, But it turned out to be a simpler problem of multiple versions of JREs/JDKs installed. 我遇到过类似的问题,但事实证明,安装多个版本的JRE / JDK是一个更简单的问题。

Try Debug -> Run Configuration -> JRE -> Alternate JRE -> select JDK 1.6.0_24. 尝试调试 - >运行配置 - > JRE - >备用JRE - >选择JDK 1.6.0_24。

Also check for project build paths if correct Jars are been used. 如果使用了正确的Jars,还要检查项目构建路径。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM