Related questions
My case
I'm compiling a project using maven 3.1.0. Then it is deployed on Tomcat 7 On my stacktrace, I get (Unknown Source) instead of (myclass.java:14). It happens with my classes but works normally with others libraries.
From the related topics, I learn that it is due to missing line number in the class files. It may be due because the use of a jre or a wrong configuration. Here is some step I have tried:
- I recently moved from jdk 1.6 to jdk1.7.0_21 (which looks to be the cause of the problem). I tried with three java installations (jdk1.7.0_21, 32 & 64bits and jdk1.7.0_45). JAVA_HOME is pointing to the right folder.
I see that we can add debug and debuglevel option to javac. I tried to add them to maven with the following configuration. I also force to use javac instead of javax.
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>${jdk.version}</source> <target>${jdk.version}</target> <debuglevel>lines,vars,source</debuglevel> <debug>true</debug> <forceJavacCompilerUse>true</forceJavacCompilerUse> </configuration> </plugin>
- Erase target file and tomcat war.
Nothing works...
EDIT
Using javap -l
on the class shows the LineNumberTable:
public void init();
LineNumberTable:
line 31: 0
line 32: 10
line 33: 21
...
The problem comes most likely from the tomcat7 side.