1 2 Previous Next 20 Replies Latest reply on Aug 30, 2002 2:10 AM by tsangcn Go to original post
      • 15. Re: why jsp files recomplie when each I restart the server
        tsangcn

        I have the following discovering, please give comment.

        When JBoss deploy an EAR, it will unpack the EAR into a directory under server/default/tmp.
        Then it will unpack the WAR into another directory, say JBOSS_TMP.
        When shutdown JBoss, it will try to delete the stuff into JBOSS_TMP.
        If for some reason, not successful, it will delete the stuff during restart of JBoss.
        When a JSP is requested, Jasper is invoked. Jasper will compile the JSP into a servlet and into a servlet class.
        The generated stuff of JSP are put in anther directory, say SCRATCHDIR, controlled by a parameter "scratchdir" of Jasper.
        So everytime a JSP is requested, Jasper will compare if the JSP is newer than the stuff in SCRATCHDIR to determine if recompile is needed.

        What happens is :

        In JBoss 2.4.4 with Tomcat 3.2.3, JBOSS_TMP and SCRATCHDIR are two different directories. So everything is OK.

        In JBoss 3.0.0 and 3.0.1, JBOSS_TMP and SCRATCHDIR are the same directory.
        So whenever you shutdown JBoss, it will delete all stuff in JBOSS_TMP and thus SCRATCHDIR.
        Then the next time JBoss is restarted, Jasper will do recompile of all JSP as SCRATCHDIR is cleared.

        In JBoss 3.0.1 with Tomcat, you can control JBoss not to delete the JBOSS_TMP by specifying an attribute in tomcat4-service.xml (thanks to Pascal) as

        false

        Then all the stuff remain when JBoss shutdown, and thus no recompilation of JSP when JBoss restarted.
        At last, I can have fast page loading.

        But for JBoss 3.0.1 with Jetty, there are no such attribute as DeleteWorkDirs.
        I have try to specify another location for SCRATCHDIR in web.xml so that JBOSS_TMP and SCRATCHDIR are two different directories.
        But the JSP are still recompiled next time JBoss is restarted.

        Then I found that in JBoss 2.4.4 the JSP are unpacked from the WAR file with the file date unchanged.
        But in JBoss 3.0.1, the date of the JSP are changed to the current date and time !!!
        So I think this may be another cause the recompilation of JSP.

        I have WASTE A WHOLE WEEKS TIME to try to stop it from recompile of JSP.
        And at last, I am still failed.

        Although JBoss with Tomcat can avoid JSP recompilation, but I have other problem with Tomcat which not found in JBoss with Jetty !!!

        Thanks
        CN

        • 16. Re: why jsp files recomplie when each I restart the server
          tsangcn

          I have the following discovering, please give comment.

          When JBoss deploy an EAR, it will unpack the EAR into a directory under server/default/tmp.
          Then it will unpack the WAR into another directory, say JBOSS_TMP.
          When shutdown JBoss, it will try to delete the stuff into JBOSS_TMP.
          If for some reason, not successful, it will delete the stuff during restart of JBoss.
          When a JSP is requested, Jasper is invoked. Jasper will compile the JSP into a servlet and into a servlet class.
          The generated stuff of JSP are put in anther directory, say SCRATCHDIR, controlled by a parameter "scratchdir" of Jasper.
          So everytime a JSP is requested, Jasper will compare if the JSP is newer than the stuff in SCRATCHDIR to determine if recompile is needed.

          What happens is :

          In JBoss 2.4.4 with Tomcat 3.2.3, JBOSS_TMP and SCRATCHDIR are two different directories. So everything is OK.

          In JBoss 3.0.0 and 3.0.1, JBOSS_TMP and SCRATCHDIR are the same directory.
          So whenever you shutdown JBoss, it will delete all stuff in JBOSS_TMP and thus SCRATCHDIR.
          Then the next time JBoss is restarted, Jasper will do recompile of all JSP as SCRATCHDIR is cleared.

          In JBoss 3.0.1 with Tomcat, you can control JBoss not to delete the JBOSS_TMP by specifying an attribute in tomcat4-service.xml (thanks to Pascal) as

          false

          Then all the stuff remain when JBoss shutdown, and thus no recompilation of JSP when JBoss restarted.
          At last, I can have fast page loading.

          But for JBoss 3.0.1 with Jetty, there are no such attribute as DeleteWorkDirs.
          I have try to specify another location for SCRATCHDIR in web.xml so that JBOSS_TMP and SCRATCHDIR are two different directories.
          But the JSP are still recompiled next time JBoss is restarted.

          Then I found that in JBoss 2.4.4 the JSP are unpacked from the WAR file with the file date unchanged.
          But in JBoss 3.0.1, the date of the JSP are changed to the current date and time !!!
          So I think this may be another cause the recompilation of JSP.

          I have WASTE A WHOLE WEEKS TIME to try to stop it from recompile of JSP.
          And at last, I am still failed.

          Although JBoss with Tomcat can avoid JSP recompilation, but I have other problem with Tomcat which not found in JBoss with Jetty !!!

          Thanks
          CN

          • 17. Re: why jsp files recomplie when each I restart the server
            tsangcn

            Sorry for so many repeated posts.
            It is due to the Netscape browser I am using always have some problem with this site

            CN

            • 18. Re: why jsp files recomplie when each I restart the server

              For Jetty :

              I have just added a FAQ entry (search down for 'keepgenerated').

              Jetty and Tomcat both use Jasper, so both will show the same behaviour.

              The key to the problem is that your webapp will be undeployed and then redeployed on bouncing JBoss....


              The FAQ is here - please feedback if you can/cannot get this to work with Jboss/Jetty


              Jules

              • 19. Re: why jsp files recomplie when each I restart the server

                For Jetty :

                I have just added a FAQ entry (search down for 'keepgenerated').

                Jetty and Tomcat both use Jasper, so both will show the same behaviour.

                The key to the problem is that your webapp will be undeployed and then redeployed on bouncing JBoss....


                The FAQ is here - please feedback if you can/cannot get this to work with Jboss/Jetty

                http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jboss/contrib/jetty/FAQ?rev=HEAD&content-type=text/vnd.viewcvs-markup



                Jules

                • 20. Re: why jsp files recomplie when each I restart the server
                  tsangcn

                  Hello Jules,

                  I have read the jboss-jetty FAQ. It gives me valuable information. But my big problem still not solved.
                  I have several questions about jboss-jetty.

                  (1) I want to keep the webdefault.xml in org.mortbay.jetty.jar unmodified as shipped.
                  And it seems that I can specified a custom version in the WebDefault attribute in jboss-service.xml
                  I have tried many ways but jbossweb always complaint cannot find the specified webdefault.xml
                  So, how to specified a custom version of webdefault.xml in WebDefault attribute in jboss-service.xml
                  and where should I put the webdefault.xml ?

                  (2) The shipped webdefault.xml told that keepgenerated default to be true already, and it is for the generated source code.
                  So, it seems that it is of no help to the on going recompilation of JSP.

                  (3) I have found that JBoss unpack the WAR in /tmp/Jetty__<Jetty-Port-Number>___<war-context> which will be deleted when Jboss shutdown.
                  And the compiled JSP also exist in this directory. That means the compiled JSP will be deleted when JBoss shutdown.
                  Thus, Jasper MUST RECOMPILE JSP whenever JBoss restarted.
                  And, this is my big problem now.
                  I have not tried to precompile JSP manually. But I think precompile JSP may be a good process when deploy to user testing or production system.
                  But it is not so convenient in the development stage.

                  Thanks
                  CN

                  1 2 Previous Next