在尝试设置断点时,我在Eclipse中得到这个奇怪的错误。
Unable to insert breakpoint Absent Line Number Information
我勾选了编译器选项的复选框,但运气不好。
在尝试设置断点时,我在Eclipse中得到这个奇怪的错误。
Unable to insert breakpoint Absent Line Number Information
我勾选了编译器选项的复选框,但运气不好。
当前回答
我发现了这条信息的另一个原因。我在编程Scala。解决方案是:
打开运行->调试配置 在主选项卡的底部,在“应用”和“恢复”按钮旁边,有一个文本说明你正在使用哪个启动器,旁边有一个超链接说“选择其他”。这是一个奇怪的UI元素,乍一看并不可行。 使用“选择其他”链接并选择“Scala应用程序(新调试器)启动器”。另一个似乎不能与Scala一起工作。
现在调试应该可以工作了。注意,我已经安装了Scala IDE插件,如果您没有这个选项,那么这个选项可能是不可用的。
其他回答
我在jetty服务器上使用ANT编译新的。war文件时也遇到了同样的问题。在你必须像之前写的那样设置Java compiler之后,你应该创建相同版本的jdk/jre编译器和构建路径(例如jdk 1.6v33, jdk 1.7, ....)。
我什么都做了,还是没工作。解决方案是删除已编译的.class文件和生成的war文件的目标,现在它的工作:)
我有同样的错误与JBoss 7.1.. 我和泽菲罗做了同样的事。只是忽略了错误,我能够正常放置断点。 在我的情况下,我正在构建思想蚂蚁生成器,这是我的javac任务:
<javac
srcdir="${src.dir}"
destdir="${build.classes.dir}"
includeantruntime="false"
debug="${debug}"
verbose="false"
debuglevel="lines,vars,source"
source="1.6"
target="1.6">
<!-- Sppressing warning for setting an older source without bootclasspath
(see: https://blogs.oracle.com/darcy/entry/bootclasspath_older_source) -->
<compilerarg value="-Xlint:-options"/>
<classpath>
<fileset dir="${lib.dir}" includes="*.jar" />
<fileset dir="${jboss.lib.dir}" includes="**/*.jar" />
</classpath>
</javac>
这里有详细的解释:
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
你完蛋了!!
在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