On Tue, Nov 25, 2003 at 04:51:21PM +0100, Anders Engström wrote:
> On Mon, Nov 24, 2003 at 04:27:44PM +0000, Matthew Oatham wrote:
> > Hi,
> > 
> > Is there any way to prevent JSP pages being recompiled everytime JBoss 
> > restarts? i.e I deploy the web app - run the jsp - restart JBoss and tr-run 
> > a JSP - instead of using a cached copy of the jsp page it is re-compiled. 
> > How can i prevent this?
> > 
> 
> I'm very interested to know if this is possible too.
> 
> After a server restart it takes forever before the application runs
> smooth due to the fact that each JSP have to be re-compiled.
> 

Ok, replying to my own post...

You can specify a path where tomcat should compile and save the JSP's
using the "scratchdir" parameter for the Jasper servlet :) The default
location of this directory is the working dir of the web-application -
and this directory will be removed when the application is un-deployed
(JBoss is shutdown). Set this servlet parameter to another directory
where the compiled files will be left untouched between server restarts.

So - add the following to your web.xml:

<servlet>
   <servlet-name>jsp</servlet-name>
   <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
   <init-param>
      <param-name>scratchdir</param-name>
      <param-value>/path/to/jsp/compile/dir</param-value>
   </init-param>
</servlet>

...

<servlet-mapping>
   <servlet-name>jsp</servlet-name>
   <url-pattern>*.jsp</url-pattern>
</servlet-mapping>

Also - check out the file
<jboss-home>/server/default/deploy/jbossweb-tomcat41.sar/web.xml for
other parameters (development=false might be nice too).

The above is using JBoss 3.2.2 final.

//Anders



-- 
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. Anders Engström         [EMAIL PROTECTED]
. http://www.gnejs.net    PGP-Key: ED010E7F
. [Your mind is like an umbrella. It doesn't work unless you open it.]  

Attachment: signature.asc
Description: Digital signature

Reply via email to