在尝试设置断点时,我在Eclipse中得到这个奇怪的错误。

Unable to insert breakpoint Absent Line Number Information

我勾选了编译器选项的复选框,但运气不好。


当前回答

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中删除应用程序 停止服务器 从webapps中删除应用文件夹 从服务器中的临时文件夹中删除内容 从服务器中的工作文件夹中删除内容 在Eclipse上重新打开应用程序 启动服务器

可能有些步骤是不需要的,但“以防万一”。

因此,如果前面的解决方案仍然不适合你。试试这个。 我希望这对你有所帮助;-)

当我用@ManagedBean (javax.annotation.ManagedBean)注释类时,我发现了这个问题。在JBoss EAP 6.2.0上运行新编译的应用程序时出现警告消息。忽略它并继续运行并没有帮助——断点从未到达。

我在JSF页面中使用EL调用该bean。现在…@ManagedBean可能不适合(我是CDI的新手)。当我将注释更改为@Model时,bean执行了,但断点警告也消失了,我像预期的那样击中了断点。

总之,看起来@ManagedBean注释弄乱了行号,不管它是否使用了错误的注释。

我在jetty服务器上使用ANT编译新的。war文件时也遇到了同样的问题。在你必须像之前写的那样设置Java compiler之后,你应该创建相同版本的jdk/jre编译器和构建路径(例如jdk 1.6v33, jdk 1.7, ....)。

我什么都做了,还是没工作。解决方案是删除已编译的.class文件和生成的war文件的目标,现在它的工作:)

我试图调试日志管理器,需要将jre更改为jdk,然后在“主”选项卡中选择这个jdk,调试配置的“Java运行时环境”|“运行时jre”,然后一切正常。

在编译/构建jar时,我做了上面列出的所有事情-仍然有同样的问题。

最终,在启动服务器时,下面列出的jvmarg更改最终为我工作:

删除/注释了一堆与javaagent和bootclasspath相关的jvm参数。

<!-- jvmarg value=“${agentfile}” /-->

< !贾维德- lib /雷丁——>

<!-- jvmarg value=“-Xbootclasspath/a:/foo /-->

打开/取消注释以下行:

<jvmarg value= -Xdebug />

然后,当我启动服务器时,我就可以到达断点了。我怀疑javaagent在某种程度上干扰了Eclipse检测行号的能力。