Hi All,

There has been some discussion on here and on the TAGLIBS list about
precompiling JSP's in Tomcat.

To avoid confusion, before I go on I want to point out that there has been a
change in Tomcat 4.1.8 in the naming conventions of servlets generated from
JSP's.

In 4.1.8 a JSP file CATALINA_HOME/webapps/myApp/main.jsp gets compiled into
a servlet  CATALINA_HOME/work/Standalone/localhost/myApp/main_jsp.java.

Prior to 4.1.8 the servlet created was called main$jsp.java.  So they
changed the name convention from $jsp.java to _jsp.java.

I'll use the 4.1.8 names in this post.

Anyway, when I use jspc to precompile I get all the .java files in  , but no
class files.  Does jspc only generate the servlet java files?  The whole
point of precompiling was to prevent javac from being called to compile
those servlets to work around the javac memory leak and speed up page
loading.

Or am I doing something wrong?

I'll list the commands I used below so you can see if I'm doing it right.
Before that though, I did find that calling a JSP page in Tomcat with the
?jsp_precompile argument resulted in the JSP being precompiled and the class
file shows up in CATALINA_HOME/work/Standalone/localhost/myApp.

For example in the browser type
http://myHost.myDomain.com/myApp/main.jsp?jsp_precompile and voila the files
main_jsp.java and main_jsp.class appear in the
CATALINA_HOME/work/Standalone/localhost/myApp directory.

To automate this for entire webapps  Mark Wutka's book "Special Edition
Using Java Server Pages and Servlets" from Que books has a utility program
to look at a webapp on the server and call every JSP file with
?jsp_precompile.

The author has the code on his web site for download at:
http://www.wutka.com/download.shtml.  Select either Windows or Unix format
on this page to download all the examples from his book.

After you unpack this download go into the folder for chapter 10 and look
for Precompile.java.  Compile that program and run it from the command line
with the base URL of the server and the directoryname as parameters, in this
case:

java Precompile http://myHost.myDomain.com myApp

Unfortunately the program is simple and doesn't support SSL so for secure
webApps you'll have to turn off security to precompile or add SSL to the
Precompile.java program.

Now to see what I'm doing wrong.  I'm using Unix so I use jspc.sh instead of
jspc.bat.  The commands I use to call jspc:

I set the CATALINA_HOME environment variables and the JAVA_HOME environment
variable.  I can call java, javac and the other Java utilities.

cd CATALINA_HOME
bin/jspc.sh -webapp webapps/myApp

Jasper campiles all theJSP's in myApp to servlet java files and puts them in
CATALINA_HOME/work/Standalone/localhost/myApp, but no class files get
generated.

Any ideas?

Thanks,

Rick


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to