(Unknown Source) in Exception Stack Trace

(Unknown Source) in Exception stack trace

This is normally related to missing debug information. You are probably using JRE (not JDK), which does not include debug information for rt.jar classes. Try using full JDK, you'll get proper locations in the stack trace:

Exception in thread "main" java.lang.NullPointerException
at java.lang.String.<init>(String.java:177)
at java.lang.String.valueOf(String.java:2840)
at StringValueOfNull.main(StringValueOfNull.java:3)

Why do I see unknown source in stack traces when I have sources downloaded?

Java libraries can be compiled with debug information that includes the source file and the line number information. A lot of libraries are compiled with this information, but apparently HSQLDB is compiled without that information (probably because this results in slightly smaller class files).

The availability of this information has nothing to do with you having downloaded the sources or not, this only depends on how the classes in the library JAR were compiled.

Looking at the files available in Maven specifically for HSQLDB, it seems that using <classifier>debug</classifier> in your Maven dependency may well use a version of the library that does include this debug information. However, I haven't verified this.

Unknown Source in java stack trace, yet line numbers are in the class file

I think the correct way is:

<javac debug="true" debuglevel="lines,vars,source"

Note there are no spaces between lines,vars,source

Why does my servlet stacktrace show Unknown Source for my classes?

Tomcat cannot provide you more detailed information unless the classes in question were compiled with debugging information. Without this debugging information, the JVM cannot determine what line of code the error occurred on.

Edit: You can ask the compiler to include this information by specifying the -g option when running javac on the command line. You can also specify this option using the debug parameter of the Javac Ant task.



Related Topics



Leave a reply



Submit