Setting: - 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 cross-platform - Sample page below below Problem: 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 a$jsp.java). the exception: ---8<--- 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: /mnt/project/jakarta-tomcat-4.0.4/work/Standalone/localhost/jesse/a$jsp.java:1813: Variable _jspx_th_c_out_51 may not have been initialized. } while (_jspx_th_c_out_51.doAfterBody() == javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); ^ An error occurred at line: 56 in the jsp file: /a.jsp Generated servlet error: /mnt/project/jakarta-tomcat-4.0.4/work/Standalone/localhost/jesse/a$jsp.java:1819: Variable _jspx_th_c_out_51 may not have been initialized. if (_jspx_th_c_out_51.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) ^ 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$JspServletWrapper.loadIfNecessary(JspServlet.java:176) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:188) 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) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) -snip- ---8<--- part of the generated code: ---8<--- 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); _jspx_th_c_out_51.doInitBody(); } do { // end // begin [file="/a.jsp";from=(55,0);to=(55,21)] } while (_jspx_th_c_out_51.doAfterBody() == javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGA IN); } finally { if (_jspx_eval_c_out_51 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) out = pageContext.popBody(); } ---8<--- sample page: ---8<--- <html> <%@ taglib uri="/jstl-c" prefix="c" %> <head><title> a </title></head> <body> <c:out value="TEST"/><br> ...repeat the line above for 51 more times... </body> </html> ---8<--- sample web.xml: ---8<--- <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <taglib> <taglib-uri>/jstl-c</taglib-uri> <taglib-location>/WEB-INF/jstl/c.tld</taglib-location> </taglib> </web-app> ---8<---
This problem likely does not exist when running with JDK 1.3 and the classic compiler.
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)
To web application's WEB-INF/lib directory, do you have deployed JAR files which are included in the JSTL 1.0 RI ???
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?
Hi, 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.
This is a problem with jasper. Use jasper2. (4.1.X)