Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse - Unable to install breakpoint due to missing line number attributes

People also ask

Why breakpoints are not working in Eclipse?

The solution was to enable it again, start a debug session, the breakpoint is hit and shown in the UI, then disable again the option. There is also another simpler way that will make Eclipse show the debugging highlight at the breakpoint or rather refresh the debugging UI to work as it should.

How do I enable breakpoints in eclipse?

Breakpoints To define a breakpoint in your source code, right-click in the left margin in the Java editor and select Toggle Breakpoint. Alternatively, you can double-click on this position. The Breakpoints view allows you to delete and deactivate Breakpoints and modify their properties.

How do I skip all debug points in eclipse?

Eclipse define one command "skip all breakpoints", but no "enable all breakpoints". We can just change "skip all breakpoints" command to "toggle all breakpoints". Now we can map "toggle all breakpoints" to shortcuts and use it to enable and disable all breakpoints.


I had the same error message in Eclipse 3.4.1, SUN JVM1.6.0_07 connected to Tomcat 6.0 (running in debug-mode on a different machine, Sun JVM1.6.0_16, the debug connection did work correctly).

Window --> Preferences --> Java --> Compiler --> Classfile Generation: "add line number attributes to generated class file" was checked. I did a clean, recompile. I did uncheck it, recompile, check it, recompile. I made sure the project did use the global settings. Still the same message.

I switched to ant build, using

<javac srcdir="./src/java" destdir="./bin" debug="true">

Still, same message.

I didn't find out what caused this message and why it wouldn't go away. Though it seemed to have something to do with the running Tomcat debug session: when disconnected, recompiling solves the issue. But on connecting the debugger to Tomcat or on setting new breakpoints during a connected debug session, it appeared again.

However, it turned out the message was wrong: I was indeed able to debug and set breakpoints, both before and during debugging (javap -l did show line numbers, too). So just ignore it :)


  1. In eclipse menu, go to Window->Preferences->Java->Compiler
  2. Unmark checkbox "Add line number attributes..."
  3. Click Apply -> Yes
  4. Mark checkbox "Add line number attribute..."
  5. Apply again.
  6. Go happy debugging

This fixed my issue:

  1. Window -> preferences -> server -> runtime environments
  2. Apache Tomcat -> edit
  3. Select a JDK instead of JRE

For Spring related issues consider that in some cases it generate classes "without line numbers"; for example a @Service annotated class without an interface, add the interface and you can debug. see here for a complete example.

@Service("SkillService")
public class TestServiceWithoutInterface {
   public void doSomething() {
      System.out.println("Hello TestServiceWithoutInterface");
   }
}

The service above will have an interface generated by spring causing "missing line numbers". Adding a real interface solve the generation problem:

public interface TestService {
    void doSomething();
}

@Service("SkillService")
public class TestServiceImpl implements TestService {
   public void doSomething() {
      System.out.println("Hello TestServiceImpl");
   }
}