Hi there,
 
I'm trying to pre-compile all the JSPs before deploying and running Webtop
(for fast initial invocation purposes) under Tomcat 4.0.x app server.
 
I've found both jspc.bat tool from Tomcat/bin and Ant's JspC task (that are
doing the same thing) are generating outputs (that is, .java and then .class
files) that are not recognized at runtime by Tomcat's servlet engine.

And that's because of 2 issues:
 
 1. The .java and .class filenames are not mangled by the above tools; the
Jasper compiler does that for generating unique filenames
 2.  The package name is set accordingly by the above tools on all .java
classes (ex. for /system/login/login.jsp source, a Java one called
login.java is created and the package name is system.login); Jasper sets the
hardcoded org.apache.jsp package for all .java classes generated from JSPs
(bug?).

However, if you look into the Tomcat sources (at least on the 4.0.x level
code), you'll notice there are 2 distinct contexts for compiling the JSPs:
one used at runtime (JSPCompiler.java), the second one used by jspc and Ant
task (CommandLineCompiler.java). They are not the same. The command line
compiler doesn't mangle the generated Java sources names and it also sets
the package differently. And that's enough to prevent the compiled classes
being recognized at runtime.

Didn't understand exactly why 2 contexts?
 
Any idea about how to handle this problem?
 
Thank you,
Robert Csiki

Reply via email to