Bug 41606 - The jspInit method is called twice.
The jspInit method is called twice.
Status: RESOLVED FIXED
Product: Tomcat 5
Classification: Unclassified
Component: Jasper
5.5.20
All All
: P2 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
: 45774 (view as bug list)
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2007-02-13 20:46 UTC by Suzuki Yuichiro
Modified: 2009-06-04 07:19 UTC (History)
2 users (show)



Attachments
Patch to prevent double jspInit() when a JSP is set in web.xml to load-on-startup (1006 bytes, patch)
2007-03-09 12:42 UTC, Chris Halstead
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.