DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20516>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20516 Jasper2 compilation not JSP 2.0 compliant on J2SE 1.4 Summary: Jasper2 compilation not JSP 2.0 compliant on J2SE 1.4 Product: Tomcat 5 Version: 5.0.2 Platform: PC OS/Version: Windows NT/2K Status: NEW Severity: Normal Priority: Other Component: Jasper2 AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] According to the JSP 2.0 specification, Section 11.5 - Debugging Requirements: "Full runtime support for JSR-45 (as opposed to only generating the SMAPs that are used at runtime) is only required when the JSP container is running in a J2SE 1.4 or greater environment." While Jasper2 correctly generates SMAP's during JSP compilation, when running in a J2SE 1.4 environment, the SMAP is not properly stored in the resulting class file as required by the JSP 2.0 & JSR-45 specifications. Following is a full description of the issue. It is effectively a duplicate of an email I posted to the tomcat-dev mailing list, to which there was no response. We're working to support source-level JSP debugging for Tomcat 5 using its JSR- 045 support. However,we've been unsuccessful at getting this to work because the line to code index map that we retrieve from our SourceDebugExtension JDWP request does not agree with the SMAP that was generated when my example JSP was compiled. The SMAP appears to be correct but for whatever reason the line mapping returned from the JVM has little in common with the SMAP. We've already gotten our debugging implementation working properly with WebLogic 7.0 and 8.1 so I have a high degree of confidence that once this mapping issue is resolved we'll also have a source-level JSP debugging solution for Tomcat 5 also. Here are the details of our test environment: Platform: Window 2000, latest SP JDK: 1.4.1_02-b06 Tomcat: Version 5.0.2 (alpha) Tomcat 5 JSP servlet settings from web.xml: <servlet> <servlet-name>jsp</servlet-name> <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class> <init-param> <param-name>logVerbosityLevel</param-name> <param-value>WARNING</param-value> </init-param> <init-param> <param-name>classdebuginfo</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>suppressSmap</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>dumpSmap</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>development</param-name> <param-value>true</param-value> </init-param> <load-on-startup>3</load-on-startup> </servlet> For the test, we attempt to set a breakpoint on line 18, which according to the SMAP corresponds to line 62 of the servlet. Here's the test JSP, with line numbers for convenience. 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2 <%@ page language="java" import="java.lang.*,java.util.*" %> 3 <% 4 String path = request.getContextPath(); 5 String basePath = "http://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 6 %> 7 <HTML> 8 <HEAD> 9 <BASE HREF="<%=basePath%>"> 10 <TITLE>My JSP 'TestJSP.jsp' starting page</TITLE> 11 </HEAD> 12 13 <BODY> 14 <% 15 Date date = new Date(); 16 out.println("Current time is: " + date); 17 out.println(". "); 18 date = new Date(); 19 out.println("Now the time is " + date); 20 out.println(". "); 21 %> 22 <BR>This is my test JSP page. <BR> 23 </BODY> 24 </HTML> Here's the SMAP generated by Tomcat: SMAP C:\dev\ApacheGroup\Tomcat 5.0.2alpha\work\Catalina\localhost\TomcatTest\org\apache\jsp\TomcatTestJSP_j sp.java JSP *S JSP *F + 0 TomcatTestJSP.jsp /TomcatTestJSP.jsp *L 1:42 4,3:45 7:49 8:50 9:51 9:52 9:53 10:54 10:55 11:56 13:57 15,7:59 22:67 22:68 23:69 24:70 *E Here's the generated servlet. As you can see, line 62 is correct for the breakpont request from line 18 of the JSP file. 1 package org.apache.jsp; 2 3 import javax.servlet.*; 4 import javax.servlet.http.*; 5 import javax.servlet.jsp.*; 6 import java.lang.*; 7 import java.util.*; 8 9 public final class TomcatTestJSP_jsp extends org.apache.jasper.runtime.HttpJspBase 10 implements org.apache.jasper.runtime.JspSourceDependent { 11 12 private static java.util.Vector _jspx_dependants; 13 14 public java.util.List getDependants() { 15 return _jspx_dependants; 16 } 17 18 public void _jspService(HttpServletRequest request, HttpServletResponse response) 19 throws java.io.IOException, ServletException { 20 21 JspFactory _jspxFactory = null; 22 PageContext pageContext = null; 23 HttpSession session = null; 24 ServletContext application = null; 25 ServletConfig config = null; 26 JspWriter out = null; 27 Object page = this; 28 JspWriter _jspx_out = null; 29 30 31 try { 32 _jspxFactory = JspFactory.getDefaultFactory(); 33 response.setContentType("text/html;charset=ISO-8859-1"); 34 pageContext = _jspxFactory.getPageContext(this, request, response, 35 null, true, 8192, true); 36 application = pageContext.getServletContext(); 37 config = pageContext.getServletConfig(); 38 session = pageContext.getSession(); 39 out = pageContext.getOut(); 40 _jspx_out = out; 41 42 out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\r\n"); 43 out.write("\r\n"); 44 45 String path = request.getContextPath(); 46 String basePath = "http://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 47 48 out.write("\r\n"); 49 out.write("<HTML>\r\n\t"); 50 out.write("<HEAD>\r\n\t\t"); 51 out.write("<BASE HREF=\""); 52 out.write(String.valueOf(basePath)); 53 out.write("\">\t\t\r\n\t\t"); 54 out.write("<TITLE>My JSP 'TestJSP.jsp' starting page"); 55 out.write("</TITLE>\r\n\t"); 56 out.write("</HEAD>\r\n\r\n\t"); 57 out.write("<BODY>\r\n\t "); 58 59 Date date = new Date(); 60 out.println("Current time is: " + date); 61 out.println(". "); 62 date = new Date(); 63 out.println("Now the time is " + date); 64 out.println(". "); 65 66 out.write("\r\n\t\t"); 67 out.write("<BR>This is my test JSP page. "); 68 out.write("<BR>\r\n\t"); 69 out.write("</BODY>\r\n"); 70 out.write("</HTML>\r\n"); 71 } catch (Throwable t) { 72 if (!(t instanceof javax.servlet.jsp.SkipPageException)){ 73 out = _jspx_out; 74 if (out != null && out.getBufferSize() != 0) 75 out.clearBuffer(); 76 if (pageContext != null) pageContext.handlePageException(t); 77 } 78 } finally { 79 if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext); 80 } 81 } 82 } Everything so far looks good, but the map of JSP line numbers to Java line numbers returned from the JVM looks like this: {62=[268], 79=[400], 43=[89], 48=[154], 59=[227], 32=[23], 34=[35], 73=[360], 70=[337], 60=[236], 61=[261], 68=[323], 75=[377], 63=[277], 66=[309], 81=[422], 27=[17], 64=[302], 28=[20], 38=[64], 57=[220], 37=[57], 51=[175], 23=[5], 40=[78], 72=[350], 49=[161], 54=[199], 71=[344], 22=[2], 53=[192], 21=[0], 33=[27], 78=[394], 52=[182], 24=[8], 42=[82], 36=[50], 26=[14], 55=[206], 50=[168], 67=[316], 39=[71], 76=[382], 45=[96], 74=[364], 46=[104], 25=[11], 56=[213], 69=[330]} This mapping obviously isn't correct since neither file is over 82 lines in length, line 18 has no entry at all, and it has nothing in common with the SMAP. According to the JSP 2.0 specification, full JSR-45 compliance is required when running on J2SE 1.4, and this does not appear to be the case. Again, all this code is working flawlessly with the JSR-045 implementation in WebLogic 7 & 8. I'll be glad to provide additional details, if needed, to help address this issue. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]