6 Replies Latest reply on Nov 22, 2008 11:17 AM by Stephen Weinfield

    Getting cached copy of WAR project after deploying new WAR f

    Stephen Weinfield Newbie

      using 4.2.3.GA, default configuration.

      After deploying new war file, and restarting the server, we seem to get old copy of application. There appears to be some unintended caching, although server is restarted. Any ideas?

        • 1. Re: Getting cached copy of WAR project after deploying new W
          jaikiran pai Master

          What type of caching are you seeing? Any specific jsp pages or something else? Please provide more details about your application and how you deploy the application. Do you use any IDE for deploying the application?

          • 2. Re: Getting cached copy of WAR project after deploying new W
            Stephen Weinfield Newbie

            We are seeing old JSP pages.
            App is built on a Windows XP system, uploaded to an AIX server and deployed there. Server is being restarted as well.

            • 3. Re: Getting cached copy of WAR project after deploying new W
              jaikiran pai Master

               

              "weinfie" wrote:

              App is built on a Windows XP system, uploaded to an AIX server


              Just a guess - Are the system clocks (date/time) on both these setups in sync? Maybe the AIX server's time is ahead compared to XP system and as a result?

              • 4. Re: Getting cached copy of WAR project after deploying new W
                Stephen Weinfield Newbie

                Yes, the AIX system clock is set to GMT time -- 5 hours ahead. Why would that matter?

                • 5. Re: Getting cached copy of WAR project after deploying new W
                  jaikiran pai Master

                   

                  "weinfie" wrote:
                  Yes, the AIX system clock is set to GMT time -- 5 hours ahead. Why would that matter?


                  Here's what might be happening:

                  * Let's consider that you have an application named MyApp.war which you build on a XP system at 2 PM.

                  * Then for the first time you move this application to the AIX box which is 5 hours ahead (i.e. 7 PM).

                  * You start the server on the AIX box access the application and everything goes smooth the first time. Internally, JBoss compiles the JSPs and copies it over to %JBOSS_HOME%/server/< serverName>/work/localhost/< subfolder> folder. The timestamp of these files is 7:xx PM (i.e. 5 hours ahead of the XP box).

                  * You then stop JBoss. But the server (by default) does not clean the work folder on application undeployment or JBoss shutdown. So the files in the work folder are still there with a timestamp of 7:xx PM.
                  * Then you go back to your XP system and rebuild the application at (lets assume) 3 PM.

                  * You then copy over these files to the AIX box where it is 8 PM now. The timestamp of this copied over WAR remains 3 PM on the AIX box.

                  * You start the server. And then access the jsp. JBoss checks its work folder to see whether the jps is already compiled. It finds that there is a compiled version. It then checks the timestamp of the compiled version in the version folder (which is 7:xx PM) and compares it with the timestamp with the jsp in the deploy folder (which is 3 PM). This check is done to see whether any recompilation is necessary. Since the compiled file is having a date ahead of the actual file, the server does not recompile the JSP and uses the earlier one. And that's why you see this "cache" effect.

                  One way to solve this issue is to clear out the work folder when the application is undeployed or server shutdown. Since you use JBoss-4.2.x, there's already a configurable property at the server level which can take care of this. On the AIX box, inside the %JBOSS_HOME%/server/< serverName>/deploy/jboss-web.deployer/META-INF/jboss-service.xml file, set the DeleteWorkDirOnContextDestroy to true (by default its false):

                  <!--Flag to delete the Work Dir on Context Destroy -->
                   <attribute name="DeleteWorkDirOnContextDestroy">true</attribute>


                  P.S: All this is just based on what i think might be happening. I don't have multiple systems where i can test this theory. Importantly, i don't know whether copying a file from a XP box to a AIX box would retain the timestamp of XP box.

                  • 6. Re: Getting cached copy of WAR project after deploying new W
                    Stephen Weinfield Newbie

                    This sounds very plausible. I will try this out shortly when I have access to the AIX server running on GMT. Thank you very much.