在尝试设置断点时,我在Eclipse中得到这个奇怪的错误。
Unable to insert breakpoint Absent Line Number Information
我勾选了编译器选项的复选框,但运气不好。
在尝试设置断点时,我在Eclipse中得到这个奇怪的错误。
Unable to insert breakpoint Absent Line Number Information
我勾选了编译器选项的复选框,但运气不好。
当前回答
从Spring AOP得到这个消息(似乎来自CGLIB库)。点击忽略似乎工作正常,我仍然可以调试。
其他回答
我在试图从Eclipse以调试模式启动Tomcat时遇到了这个问题。我有一个ANT构建文件负责编译和部署。在将调试标志设置为true(如其他答案所述)并重新部署应用程序后,它可以正常工作:
<javac srcdir="./src/java" destdir="./bin" debug="true">
注意:如果您刚刚添加了调试标志并重新编译,那么仍然需要将应用程序重新部署到服务器,因为Eclipse就是在服务器上调试类文件的。很明显,但很容易花一个小时左右的时间挠头,想知道为什么它不管用(相信我)。
在编译/构建jar时,我做了上面列出的所有事情-仍然有同样的问题。
最终,在启动服务器时,下面列出的jvmarg更改最终为我工作:
删除/注释了一堆与javaagent和bootclasspath相关的jvm参数。
<!-- jvmarg value=“${agentfile}” /-->
< !贾维德- lib /雷丁——>
<!-- jvmarg value=“-Xbootclasspath/a:/foo /-->
打开/取消注释以下行:
<jvmarg value= -Xdebug />
然后,当我启动服务器时,我就可以到达断点了。我怀疑javaagent在某种程度上干扰了Eclipse检测行号的能力。
我在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
你完蛋了!!
这里有详细的解释:
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中,您可以通过前面提到的选项打开它,
窗口—>首选项—> Java—>编译器—>类文件生成:“添加行号属性生成类文件”
但是如果您有一个jar文件,那么您将得到编译后的输出。解决这个问题没有简单的方法。
如果您可以访问源代码并使用ant来获取jar文件,那么您可以如下所示修改ant任务。
<javac destdir="${build.destDir}" srcdir="${build.srcDir}" source="1.6" fork="true" target="${javac.target}" debug="on" debuglevel="lines,vars,source" deprecation="on" memoryInitialSize="512m" memoryMaximumSize="1024m" optimize="true" >
快乐的调试. .
裁判: http://doc.sumy.ua/prog/Java/javanut/ch16_04.htm