在尝试设置断点时,我在Eclipse中得到这个奇怪的错误。
Unable to insert breakpoint Absent Line Number Information
我勾选了编译器选项的复选框,但运气不好。
在尝试设置断点时,我在Eclipse中得到这个奇怪的错误。
Unable to insert breakpoint Absent Line Number Information
我勾选了编译器选项的复选框,但运气不好。
当前回答
在调试部署到Tomcat的WAR(由多个Eclipse项目构件构造)时,我遇到了同样的问题。
我正在使用ANT构建脚本构建所有内容。如果这是您正在做的事情,请确保在您获得的每个javac ant任务上设置了debug=true标志。这是我唯一的问题-我希望它能帮助你的问题!
其他回答
我几乎试过了这里所有的解决方案,但都不走运。你试过点击"别再跟我说"吗?这样做之后,我重新启动了我的程序,一切都很好。Eclipse碰到我的断点时,好像什么都没有发生。
对我来说,根本原因是Eclipse试图为自动生成的Spring CGLIB代理对象设置调试。除非你需要调试这个级别的东西,否则你应该忽略这个问题。
在使用Spring Tool Suite (STS)启动Java EE项目时,我们也会遇到这个消息,但是我们可以忽略这个消息,因为一切都很好。
这里有详细的解释:
https://github.com/spring-projects/spring-ide/issues/78
只是为了将来参考,这是答案的相关部分(忽略引用Spring Boot应用程序的事实,在许多其他情况下行为是相同的):
Whenever you set a breakpoint in Eclipse/STS, the IDE tries to set the breakpoint in the VM if you launch an app. That is what happens in your case when you run the boot app in debug mode. For each class that gets loaded into the JVM, the IDE checks whether it needs to set a breakpoint or not. If it decides to set the breakpoint, the tries to do so (using the information from the breakpoint definition in the IDE, including its line number, since you usually set line breakpoints on a source file at a given line). This decision (whether to set the breakpoint on a given loaded class or not) checks the types that you set the breakpoint on, enclosing types, and inner classes. This makes sure that breakpoints for inner classes (even anonymous inner classes) are set to the JVM (and are not ignored). Spring Boot generates an inner class for your controller at runtime (this is the CGLIB generated inner class that appears in the error message). When the JVM loads that class, it tries to set the line number breakpoint of the enclosing type (for this inner class). Since the generated inner class doesn't have any line number information (it doesn't need to have line number information), setting the breakpoint fails for this inner class with the mentioned error message. When the IDE loads the enclosing type (your controller class itself), it also tries to set the line breakpoint and succeeds with that. This is visualized with the check marker on the breakpoint marker. Therefore you can safely ignore the error message that shows up. To avoid this error message to show up, you can go to the preferences (Java -> Debug) and disable "Warn when unable to install breakpoint due to missing line number attributes".
我在eclipse IDE中也遇到了同样的问题。我阅读了这个问题的所有答案,并尝试了几乎所有提到的设置,但运气不好。
所以,我尝试改变项目的运行时库,以前它是JRE - Java SE 1.8
我尝试将JRE更改为JDK,它为我工作:
从JRE切换到JDK的步骤如下:
Right click on project Click Properties -> Java Build Path Select tab - "Libraries" Click on "Add Library" button. "Add Library" window will open Select "JRE System Library" -> Click Next button Select "Alternate JRE" Click on Installed JRE button In New window click on "Add". This will open another window "Add JRE". Select "Standard VM". Click Next. Click on Directory button. Choose path of your "JDK" installation directory and click ok. Then Click Finish. Now check on newly added "JDK" Delete all other installed JRE's from the list(Optional) Apply-> OK Select "JDK from alternate JRE dropdown and Click on "Finish" Now from the list depicted below remove JRE instance Click Apply -> OK
你完蛋了!!
我的情况与此类似:
我正在调试一个JUnit测试 我使用Mockito创建一个间谍,如在spyTask =间谍(new Task()) 我将断点放在我正在监视的类中(在Task.java中)
这个断点会生成问题中的错误,每次我运行Debug As…> JUnit测试
为了解决这个问题,我将断点“向上”移动到实际测试中(在TaskTest.java内部)。一旦执行停止,我将断点添加回原来的位置(在Task.java中)。
我仍然得到相同的错误,但点击“确定”后,断点工作正常。
希望这对大家有所帮助,
-gmale