Bug 41606

Summary: The jspInit method is called twice.
Product: Tomcat 5 Reporter: Suzuki Yuichiro <suzuki.yuichiro>
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal CC: Brian, robert.flaherty
Priority: P2    
Version: 5.5.20   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Patch to prevent double jspInit() when a JSP is set in web.xml to load-on-startup

Description Suzuki Yuichiro 2007-02-13 20:46:54 UTC
The problem is:
The jspInit method is called twice.

The definition is:
-The JSP background compilations are enable.
 (In default web.xml, define checkInterval and define development false.)
-Define the JSP with <servlet> and <load-on-startup> tag in web.xml.

The proposing:
org/apache/jasper/compiler/Compiler.java 
----
public void compile(boolean compileClass, boolean jspcMode)
    throws FileNotFoundException, JasperException, Exception
{
....
    if( compileClass ) {
        File targetFile = new File(ctxt.getClassFileName());
        if (targetFile.exists()) {
            long targetLastModified = targetFile.lastModified();
            if (jsw != null) {
                jsw.setServletClassLastModifiedTime(targetLastModified);
            }   
        }
    }
}// last of the method.
----

Regards,
Yuichiro
Comment 1 Chris Halstead 2007-03-09 12:42:55 UTC
Created attachment 19692 [details]
Patch to prevent double jspInit() when a JSP is set in web.xml to load-on-startup

Confirmed in 5.5.23.  I've attached a patch based on the OP's suggested fix.
Comment 2 Mark Thomas 2009-03-27 02:43:34 UTC
*** Bug 45774 has been marked as a duplicate of this bug. ***
Comment 3 Mark Thomas 2009-03-27 02:49:45 UTC
Chris - thanks for the patch.

The patch has been applied to trunk and proposed for 6.0.x and 5.5.x
Comment 4 Mark Thomas 2009-04-14 14:58:08 UTC
*** Bug 47013 has been marked as a duplicate of this bug. ***
Comment 5 Mark Thomas 2009-04-28 04:22:43 UTC
This has been fixed in 6.0.x and will be included in 6.0.20 onwards.
Comment 6 Mark Thomas 2009-06-04 07:19:08 UTC
This has been fixed in 5.5.x and will be included in 5.5.28 onwards.