Bug 9958

Summary: JSTL page compile fails with many JSTL core tags
Product: Tomcat 4 Reporter: Jesse Hallio <jesse>
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Severity: major CC: petr.pisl
Priority: P1 Keywords: JDK1.4
Version: 4.0.4 Final   
Target Milestone: ---   
Hardware: Sun   
OS: All   

Description Jesse Hallio 2002-06-18 14:30:32 UTC
- a JSTL page using only jstl-c (el version), <c:out>.
- JSTL version is the 1.0 (copied from jwsdp-1.0).
- SunOS host 5.8 Generic_108528-13 sun4u sparc SUNW,UltraSPARC-IIi-cEngine
- java version "1.4.0"
  Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
  Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
- JAVA_OPTS=-mx256m
- W2k/tomcat-4.0.3/sun java 1.4.0 has the same problem -> probably
- Sample page below below

 Adding one more <c:out>-tag causes the exception below. By removing a <c:out>
from the crashing jsp -> the jsp compiles correctly. There is the same
problem with tomcat 4.0.3, but the needed amount of JSTL tags is somewhat lower
The problem seems to be gone in 4.1.5, but it has other issues (alongside not
being 'release').

 The line of code referenced by the exception is generated from the line of jsp
with the second-last <c:out> tag (if the comment lines are to be trusted in the
generated .java).

 Below is also the part from the generated .java, and I can't see the problem.
The file also compiles manually like it should (javac -classpath world:and:dog

the exception:
org.apache.jasper.JasperException: Unable to compile class for JSPNote:
sun.tools.javac.Main has been deprecated.

An error occurred at line: 56 in the jsp file: /a.jsp

Generated servlet error:
Variable _jspx_th_c_out_51 may not have been initialized.
                          } while (_jspx_th_c_out_51.doAfterBody() ==

An error occurred at line: 56 in the jsp file: /a.jsp

Generated servlet error:
Variable _jspx_th_c_out_51 may not have been initialized.
                  if (_jspx_th_c_out_51.doEndTag() ==
2 errors, 1 warning

	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:285)
	at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:548)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

part of the generated code:
                  int _jspx_eval_c_out_51 = _jspx_th_c_out_51.doStartTag();
                  if (_jspx_eval_c_out_51 !=
javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
                      try {
                          if (_jspx_eval_c_out_51 !=
javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
                              out = pageContext.pushBody();
_jspx_th_c_out_51.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
                          do {
                          // end
                          // begin [file="/a.jsp";from=(55,0);to=(55,21)]
                          } while (_jspx_th_c_out_51.doAfterBody() ==
                      } finally {  
                          if (_jspx_eval_c_out_51 !=
                              out = pageContext.popBody();

sample page:
<%@ taglib uri="/jstl-c" prefix="c" %>
<head><title> a </title></head>
<c:out value="TEST"/><br>
...repeat the line above for 51 more times...

sample web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
Comment 1 Remy Maucherat 2002-06-18 15:26:54 UTC
This problem likely does not exist when running with JDK 1.3 and the classic 
Comment 2 Jesse Hallio 2002-06-19 11:06:14 UTC
 Verified, does work when the jdk used is changed to
java version "1.3.1_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_03-b03)
Java HotSpot(TM) Client VM (build 1.3.1_03-b03, mixed mode)
Comment 3 Kan Ogawa 2002-06-19 11:20:30 UTC
To web application's WEB-INF/lib directory,
do you have deployed JAR files which are included in the JSTL 1.0 RI ???
Comment 4 Jesse Hallio 2002-06-19 11:49:05 UTC
The jar files in my WEB-APP/lib:

191881 Jun 17 10:31 jaxen-full.jar
 20801 Jun 17 10:30 jstl.jar
 23563 Jun 17 10:31 saxpath.jar
498612 Jun 17 10:31 standard.jar

the files are from jwsdp-1.0, which claimed to have JSTL 1.0 final. (just
checked what the jakarta.apache.org distribution directory
(http://jakarta.apache.org/builds/jakarta-taglibs/releases/standard/) has, and
it only has *-rc1 files, aren't those supposed to be release candidate 1?
Comment 5 Petr Pisl 2002-06-28 12:36:25 UTC

I have the same problem on the Solaris, Tomcat 4.0.4 or 4.0.3 and jdk1.4, but I
use struts no jstl. When I want to see a jsp in the browser in the first time,
then I get the same error. The java file for the jsp is created in the working
directory but there is not class file. When I restart Tomcat, then it's OK. But
I have to do for every longer page, which used struts in my app. 
Comment 6 Tim Funk 2003-04-18 15:43:40 UTC
This is a problem with jasper. Use jasper2. (4.1.X)