tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan" <...@mcenter.com>
Subject Re: Compile all JSPs on startup
Date Fri, 06 Aug 2004 22:29:09 GMT
I don't believe this will work.  I need something that runs automatically 
when Tomcat is restarted, and I prefer to do it without external scripts or 
batch files, etc..


At 04:20 PM 8/6/2004, you wrote:
>this is what you are looking for:
>
>http://cvs.apache.org/~fhanik/precompile.html
>
>Filip
>
>----- Original Message -----
>From: "Dan" <dan@mcenter.com>
>To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
>Sent: Friday, August 06, 2004 2:54 PM
>Subject: RE: Compile all JSPs on startup
>
>
>Here's what I want to do:
>
>After Tomcat has been restarted, I want to recompile all of the JSPs in a
>certain directory (and all child directories).  I wrote a servlet that does
>this and works fine when I run it in command line after Tomcat boots.  I
>want to precompile so the first visitor to a JSP doesn't experience that
>wait time for Tomcat to compile.
>
>
>So I tried loading my servlet (load-at-startup) at startup in Tomcat's
>web.xml (no go), my application's web.xml (no go), and even a 'dummy"
>application's web.xml (no go).
>
>The problem seems to be that the JSP pages are not available until Tomcat
>has finished the bootup process.  My servlet gets called, but when it tries
>to fetch the first URL (http://domain.com/page.jsp?precompile=true) nothing
>else happens.  Obviously the java.net.URL cannot make a connection since
>Tomcat hasn't finished booting to make JSPs available.
>
>Besides stopping/starting Tomcat and recompiling the JSPs from a batch
>script, am I just wasting my time here or is there someway to do this after
>Tomcat boots?
>
>
>stdout.log:
>Aug 6, 2004 3:39:33 PM org.apache.coyote.http11.Http11Protocol init
>INFO: Initializing Coyote HTTP/1.1 on http-8080
>Aug 6, 2004 3:39:33 PM org.apache.catalina.startup.Catalina load
>INFO: Initialization processed in 2188 ms
>Aug 6, 2004 3:39:33 PM org.apache.catalina.core.StandardService start
>INFO: Starting service Catalina
>Aug 6, 2004 3:39:33 PM org.apache.catalina.core.StandardEngine start
>INFO: Starting Servlet Engine: Apache Tomcat/5.0.27
>Aug 6, 2004 3:39:33 PM org.apache.catalina.core.StandardHost start
>INFO: XML validation disabled
>Aug 6, 2004 3:39:34 PM org.apache.catalina.startup.ContextConfig
>applicationConfig
>INFO: Missing application web.xml, using defaults only
>StandardEngine[Catalina].StandardHost[localhost].StandardContext[]
>Aug 6, 2004 3:39:35 PM org.apache.catalina.core.StandardHost getDeployer
>INFO: Create Host deployer for direct deployment ( non-jmx )
>Aug 6, 2004 3:39:35 PM org.apache.catalina.core.StandardHostDeployer install
>INFO: Processing Context configuration file URL
>file:E:\java\Tomcat\conf\Catalina\localhost\admin.xml
>Aug 6, 2004 3:39:35 PM org.apache.struts.util.PropertyMessageResources <init>
>INFO: Initializing, config='org.apache.struts.util.LocalStrings',
>returnNull=true
>Aug 6, 2004 3:39:35 PM org.apache.struts.util.PropertyMessageResources <init>
>INFO: Initializing, config='org.apache.struts.action.ActionResources',
>returnNull=true
>Aug 6, 2004 3:39:36 PM org.apache.struts.util.PropertyMessageResources <init>
>INFO: Initializing, config='org.apache.webapp.admin.ApplicationResources',
>returnNull=true
>Aug 6, 2004 3:39:38 PM org.apache.catalina.core.StandardHostDeployer install
>INFO: Processing Context configuration file URL
>file:E:\java\Tomcat\conf\Catalina\localhost\balancer.xml
>Aug 6, 2004 3:39:38 PM org.apache.catalina.core.StandardHostDeployer install
>INFO: Processing Context configuration file URL
>file:E:\java\Tomcat\conf\Catalina\localhost\manager.xml
>Aug 6, 2004 3:39:38 PM org.apache.catalina.core.StandardHostDeployer install
>INFO: Installing web application at context path /aatz from URL
>file:E:\java\Tomcat\webapps\aatz
>Aug 6, 2004 3:39:38 PM org.apache.catalina.startup.ContextConfig
>applicationConfig
>INFO: Missing application web.xml, using defaults only
>StandardEngine[Catalina].StandardHost[localhost].StandardContext[/aatz]
>Aug 6, 2004 3:39:39 PM org.apache.catalina.core.StandardHostDeployer install
>INFO: Installing web application at context path /dummy from URL
>file:E:\java\Tomcat\webapps\dummy
>RUNNING TOMCATSTARTUP
>url=http://www.domain.com/page2.jsp?precompile=true
>fetching http://www.domain.com/page2.jsp?precompile=true
>
>(this is where it hangs)
>
>
>At 10:44 AM 8/5/2004, you wrote:
>
> >Hi,
> >
> > >Is there a configuration setting for Tomcat to it recompile all JSP
> >files
> > >at start up?
> >
> >No.
> >
> >You can precompile your JSPs as noted at
> >http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jasper-howto.html#Web%20
> >Application%20Compilation and other locations.
> >
> > >If this is the only way, how and where do you specify startup servlets
> >in
> > >tomcat?  And what if I want to enable/disable this feature on startup
> > >--  what's best approach for setting the flag in tomcats config files?
> >
> >You might want to read the Servlet Specification at some point.  You
> >specify startup servlets in Tomcat the way you do in all other servlet
> >containers: by adding <load-on-startup>[number]</load-on-startup> to
> >their declaration in your web.xml file.  Since you would code this
> >servlet, you can handle enable/disable of this precompilation however
> >you want.  A likely choice would be a simple servlet init-parameter,
> >also in web.xml.  This is not specific to Tomcat and would not go in
> >Tomcat's configuration files.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message