doing javap on a jsp generated servlet from 5.5.9 starts with: Compiled from "org.apache.jsp.WEB_002dINF.jsp.components.globalheader_jsp" public final class org.apache.jsp.WEB_002dINF.jsp.components.globalheader_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent SourceFile: "org.apache.jsp.WEB_002dINF.jsp.components.globalheader_jsp" That is, the SourceFile attribute of this class is "org.apache.jsp.WEB_002dINF.jsp.components.globalheader_jsp" But this is incorrect, according to the java class file specification, specifically section: 4.7.7 The SourceFile Attribute "The string referenced by the sourcefile_index item will be interpreted as indicating the name of the source file from which this class file was compiled. It will not be interpreted as indicating the name of a directory containing the file or an absolute path name for the file; such platform- specific additional information must be supplied by the runtime interpreter or development tool at the time the file name is actually used." That means that for the above class, the SourceFile attribute should just be "globalheader_jsp.java" Note, no package or path info, as well as the .java extension. This wreaks havoc on tools such as BCEL, FindBugs, etc.
By the way, this was not the case in the 5.0 series of tomcats.
This is an Eclipse JDT compiler problem. I searched Eclipse Bugzilla and didn't see any bug resembling this so you could open a bug there.
I guess i'm not following you. I delete my web-app's work directory. i start tomcat up with start.bat, i browse a few pages. I run javap on the generated servlet. I see these errors. How does eclipse have anything to do with it?
Tomcat 5.5 uses the Eclipse JDT compiler, not javac, to compile JSP 'servlets'. Tomcat 5.0x uses javac.
Please check https://bugs.eclipse.org/bugs/show_bug.cgi?id=129383#c5. This comment suggests a fix for the org.apache.jasper.compiler.JDTCompiler class. Once I fixed it following comment 5, I got the expected result. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=129383#c9. Let me know if there is anything I can do to help.
Thank you Olivier!
Created attachment 17801 [details] fix sourcefile attribute generation Olivier Thomann found this code that was incorrectly generating the source file attribute in the class file. This patch fixes this.
Thanks for fixing this issue.