5

Starting to lose my sanity, I'm going to pull myself together to write a proper question here ..

I have no idea why or what I've done since I haven't changed anything that should affect this but all of sudden I am getting this:

Unable to install breakpoint in com.company.whatever.MyObjectService$$EnhancerBySpringCGLIB$$e3b7e123 due to missing line number attributes.

or as a screenshot:

enter image description here

Yes, I've checked that already under Prefences and followed the suggestions from here.

I don't know why but I'm getting haunted by errors like this lately - holding me off from actual work I need to get done..

This is my maven command:

mvn tomcat7:run-war -am -pl mz-web-server -Dpackage-mode=dev -Denv=dev  -DskipTests

What on earth could be the reason?

Yes, I have

  • mvn clean install
  • Open/close Eclipse
  • Refresh project explorer
  • Looked into Prefences --> Java --> Compiler --> Classfile Generation
  • ... also: unset, apply, set again, apply for Line Number Information option
  • Using JDK instead of JRE
  • Talked to god and even thought about changing my profession

but nothing helped!

Community
  • 1
  • 1
Stefan Falk
  • 23,898
  • 50
  • 191
  • 378
  • `com.company.whatever.MyObjectService$$EnhancerBySpringCGLIB$$e3b7e123 ` looks like a CGLIB-generated class, i.e. bytecode generated dynamically. Neither the maven nor IDE options are likely to help you, as there probably isn't any Java source to go with the class. – Jim Garrison Jun 28 '16 at 17:41

4 Answers4

1

You state you use maven, so your options within the IDE are unlikely to help a lot here. Instead you should most likely focus on maven or more specifically the build plugin.

Ensure you have debug mode enabled and with the correct level

for example:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <debug>true</debug>
                <debuglevel>lines,vars,source</debuglevel>
            </configuration>
        </plugin>
    </plugins>
</build>
user254948
  • 1,036
  • 6
  • 14
0

I usually have this problem with Jboss.

When i got stucked with it i just clean my deployment directory and re-deploy my war/jar, and everything works.

You can also try an "ugly" alternative and try to debug your application remotely.

Erik Paula
  • 69
  • 7
0

I guess you've tried all that cases but today I've been having problems while trying to debug an "old" and a little bit messy Spring app deployed in a Tomcat 6 with JDK 1.6.

After many checks:

  • Line numbers where properly added to .class files (checked via javap -v).
  • Correctly attached to Tomcat from Eclipse/IntelliJ.
  • Added debug and debug level properly to the build task (Ant).
  • Cleaned all cache from IDE and Tomcat, rebuild, redeployed.

But still getting that "missing line numbers" errors. The project I was having problems was developed by a third party some years ago using Ant.

What was wrong then?

Every IDE let you configure where compiled files are stored. For example with Eclipse the default folder is /bin (if it's a Maven project it's /target) and for IntelliJ it's /out. My project was using Ant and was compiling files (as indicated in the compile task in the build.xml file) in a folder like ${webroot.dir}/WEB-INF/classes and then added these .class files to the generated war.

<property name="classes.dir" value="${webroot.dir}/WEB-INF/classes" />
<target name="compile" depends="prepare,resources">
    <javac srcdir="${basedir}/src/main/java" destdir="${classes.dir}" debug="on" debuglevel="lines,vars,source">
        ...
    </javac>
</target>

The problem was that the IDE was looking in the /bin folder for the .class files but my new compiled .class files where placed in another place. After changing the output folder in the project's configuration (both Eclipse and IntelliJ), and pointed to the same Ant's compilation folder, breakpoints started to work as expected.

I know you are using Maven and my case was using Ant, but that folder mess can happen with any build automation tool where you specify the output folder and doesn't match with your project's configuration in the IDE you are using.

Hope your sanity is still okay ;)

exoddus
  • 2,230
  • 17
  • 27
0

I encountered this message when I worked only on one project in my workplace, so I came to the conclusion that because this project had the same groupID and file structure/packages to a different project in the same workplace (I was trying to change from jdbc to hibernate so I simply copied most of it). So my guess is that the compiler has a problem identifying where you put the breakpoint because the file had the same name and path, so when SPRING came into play the compiler tried to put it in the original file instead of the new one.

Changing the package caused the message to disappear.