6 Replies Latest reply on Aug 31, 2002 1:23 PM by Ever Tang

    slow JSP compilcation on jboss3.0.1+tomcat4.04

    noam Newbie

      I tried an application which worked fine on jboss3.0.0+tomcat4.03 on jboss3.0.1+tomcat4.04 and I noticed that the init stage of each JSP page is much slower in the newer version. This is quite noticable when I set the JSP's to init of start-up. This happened both on solaris and w2k with jdk1.4.
      Has anyone noticed that?

        • 1. Re: slow JSP compilcation on jboss3.0.1+tomcat4.04
          lizhi2002 Newbie

          yes ,My server is also like this

          • 2. Re: slow JSP compilcation on jboss3.0.1+tomcat4.04
            Joel Vogt Master

            what sort of figures are we talking about here? seconds, minutes, milli-seconds?

            • 3. Re: slow JSP compilcation on jboss3.0.1+tomcat4.04
              tsangcn Newbie

              I have the same problem too.

              • 4. Re: slow JSP compilcation on jboss3.0.1+tomcat4.04
                noam Newbie

                something like a few seconds for each JSP page

                • 5. Re: slow JSP compilcation on jboss3.0.1+tomcat4.04
                  gaelyn Newbie

                  I'm using JBoss3.0&Tomcat4 bundle. I'm getting really frustrated about the JSP compile. It seems to take for ever to compile (more than 10 seconde) when you first invoke the JSP page. I've searched the whole forum but didn't find any sound solution. There must be a way to fix this, would the JBoss-Tomcat integration team take this into consideration and provide a way to resolve this problem?

                  • 6. Re: slow JSP compilcation on jboss3.0.1+tomcat4.04
                    Ever Tang Newbie

                    Gaelyn, I agree with you. Probably Sun should come up with a standard to be included in JSP spec so we would have a vendor-independant solution to the pre-compilation problem.

                    I had same experence (Slow jsp compile). After searching internet without much lucky, I poked around Jasper source and figured out a work around. Here are the steps:

                    1) Pre-compile the JSPs into classes using Ant JspC task (or you can do it with Jasper.bat in tomcat/bin folder). Note: You need to specify the package name "org.apache.jsp" as a compile option
                    2) Deploy war file to jboss
                    3) After deploy is finished (IMPORTANT), copy the JSP classes to the Tomcat work folder (it's by default at $jboss_dir/catalina/work/$context_name folder, although you may change to whatever you want by adding init parameter "scratchdir" to JspServlet config in $jboss_dir/catalina/conf/web.xml" ). Note, you should copy only the classes without the directory structure. i.e., you may have your JSP classes at : classes/org/apache/jsp/XXX$jsp.class, you copy XXX$jsp.class to tomcat/work folder, without "org/apache/jsp"
                    4) Make sure the classes you copied to tomcat work folder has the current timestamp, if not, you can use "touch *" in Xnix to change the timestamp but i don't know how to do it in Windows
                    5) Try to invoke your JSP page now, you should see the notable difference

                    Note : I noticed Jasper comandline compiler (used for manually compiling JSP) and run time compiler (called by Servlet engine to compile JSP on the fly) are using different algrithm to calculate the class name for JSP page. This issue prevents you from using the trick I mentioned above cause the class names are different. Also Jasper seems to have a bug when I specify the package name for generated JSP classes. I fixed these two problems, if you are interested, write to me and I can send you the fix.