在尝试设置断点时,我在Eclipse中得到这个奇怪的错误。
Unable to insert breakpoint Absent Line Number Information
我勾选了编译器选项的复选框,但运气不好。
在尝试设置断点时,我在Eclipse中得到这个奇怪的错误。
Unable to insert breakpoint Absent Line Number Information
我勾选了编译器选项的复选框,但运气不好。
当前回答
首先,我建议确定问题是与项目相关还是与单个测试文件相关。试着在调试模式下运行任何其他测试文件。
如果问题只适用于一个文件,这可能与自我嘲笑有关(就像我的情况一样)。否则,编译器/构建设置应该被更改。在之前的评论中已经描述过了。
我只是想强调一下。这已经足够我浪费时间在修复项目设置,而这是完全没有必要的:)
其他回答
从Spring AOP得到这个消息(似乎来自CGLIB库)。点击忽略似乎工作正常,我仍然可以调试。
这招对我很管用:
在窗口——>首选项——> Java——>编译器——>类文件生成下,所有选项都必须为True。 在build.xml <javac>任务中使debug="true"。 通过ant生成的war在tomcat中部署应用程序 在Debug模式下重新启动Tomcat
因为我安装了6个不同版本的Java,所以我必须更改默认的JDK遵从性,以匹配我想使用的Java版本。当所有内容都使用Java 1.6构建/编译时,Eclipse默认将编译器遵从级别设置为Java 1.7。
所以我所做的就是
在eclipse菜单中,进入“窗口->首选项->Java->编译器” 在JDK遵从性下,我将编译器遵从性级别从1.7更改为1.6
现在Eclipse不再抱怨“无法插入缺少行号信息的断点”,并且调试断点实际上工作了!!
If someone is trying to debug Java's source code, then, this is the only solution that worked for me. Most of the above answers talk about setting the Compiler option to generate line numbers.But, if want to debug Java's source code (say java.util.HashMap), then the above options may not work for you. This is because , the project from where you intend to debug the source code is having the Java Build Path --> Library --> JRE System Library pointing to the jre jar instead of the jdk jar. The classes bundled inside jre jar have already been pre-compiled with a specific option, that will not honor the Compiler option settings. Solution, is to reconfigure your project to have the JRE System Library point to the jdk jar. The classes inside your jdk jar will honour the Compiler option settings. So, once you update your project's JRE System Library to point to the jdk jar, debug on Java source code will start working.
我几乎试过了这里所有的解决方案,但都不走运。你试过点击"别再跟我说"吗?这样做之后,我重新启动了我的程序,一切都很好。Eclipse碰到我的断点时,好像什么都没有发生。
对我来说,根本原因是Eclipse试图为自动生成的Spring CGLIB代理对象设置调试。除非你需要调试这个级别的东西,否则你应该忽略这个问题。