在尝试设置断点时,我在Eclipse中得到这个奇怪的错误。
Unable to insert breakpoint Absent Line Number Information
我勾选了编译器选项的复选框,但运气不好。
在尝试设置断点时,我在Eclipse中得到这个奇怪的错误。
Unable to insert breakpoint Absent Line Number Information
我勾选了编译器选项的复选框,但运气不好。
当前回答
这招对我很管用:
在窗口——>首选项——> Java——>编译器——>类文件生成下,所有选项都必须为True。 在build.xml <javac>任务中使debug="true"。 通过ant生成的war在tomcat中部署应用程序 在Debug模式下重新启动Tomcat
其他回答
当我用@ManagedBean (javax.annotation.ManagedBean)注释类时,我发现了这个问题。在JBoss EAP 6.2.0上运行新编译的应用程序时出现警告消息。忽略它并继续运行并没有帮助——断点从未到达。
我在JSF页面中使用EL调用该bean。现在…@ManagedBean可能不适合(我是CDI的新手)。当我将注释更改为@Model时,bean执行了,但断点警告也消失了,我像预期的那样击中了断点。
总之,看起来@ManagedBean注释弄乱了行号,不管它是否使用了错误的注释。
在Eclipse中调试时如何修复断点错误? 只替换这几行。
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
如果您确实指出了您正在使用的eclipse版本和技术(例如,Java JDT,或面向Java的AJDT,或c++ CDT),这将有所帮助。
在Java方面,我猜想您的“勾选编译器选项中的复选框”指的就是这个
在“窗口—>首选项—> Java—>编译器—>类文件生成”下,所有“类文件”生成选项都设置为True:
(1)添加可变属性, (2) addline number, (3)添加源文件名, (4)保存未使用的局部变量。
您的项目是否只在全局级别(windows Preferences)或在项目特定级别检查这些?
你确定打开的类(你试图在上面设置断点):
是您的源代码之一(并且不是来自第三方库) 是。java,而不是。class?
尝试清理所有内容并重新构建所有内容,检查潜在的jar冲突。
以上这些都对我不起作用。 下面的解决方案终于奏效了。 调试配置->类路径->用户条目->(添加要调试的项目的src文件夹)
We have very useful information to solve this problem already, but in my specific case, the problem was that as I did an update to my project from the repository, new classes were generated with the compiled source from the newest code. The problem is that I forgot to change the versions of the projects in my POM files and as the breakpoints were set on the new code and the POM files were still pointing to old versions that were available on the JAR files of a previous compilation, the classes from the JAR files were chosen and not the classes from the new code.
在恢复中,为了解决这个问题,我只需要更新主项目的POM文件的版本,清理并重新编译源代码,最后刷新环境。我希望这能对其他人有用。