9 Replies Latest reply on Jul 20, 2010 2:48 AM by Pratik Surti

    Hot Deployable Property Files

    Ricardo Cortes Newbie

      I've posted a few times regarding a specific direction I was taking in trying to achieve hot deployable property files (i.e. bundling them in JARs) but I'm about ready to give up that approach as it was only working in my staging environment and not production. Can someone tell me which approach they are using to implement hot deployable (i.e. at runtime) property files with JBoss? Currently, I'm researching using the properties-service.xml file to define a property file in the conf directory. This approach works fine when the server is first started (using getResourceBundle()) but when changes are made to the property files while the server is started they are not reflected at runtime. Any help on this topic would be awesome as I've been struggling with it for about 4-5 days now. Thanks!

        • 1. Re: Hot Deployable Property Files
          Ricardo Cortes Newbie

          So, I was able to get the property file defined in property-service.xml to be hot deployable in my staging environment but as soon as I moved the implementation to one of our production servers the properties no longer hot deployed. This is the *same* situation I was in with the JAR approach I mentioned. Does anyone know why hot deploy seems to fail when the machine is under any kind of load? I even tried disabling JBoss connections but stopping Apache and got the same result. Hmmm.

          • 2. Re: Hot Deployable Property Files
            Scott Stark Master

            And you have checked that the conf/jboss-service.xml URLDeploymentScanner has not had hot deployment disabled? What is the setting for the ScanPeriod attribute?

            • 3. Re: Hot Deployable Property Files
              Ricardo Cortes Newbie

              Below (in a follow up post as to not screw up the wrapping of this reply) is the definition of the URLDeploymentScanner from my jboss-service.xml. The scanning period is set to 5000 (5 seconds). I don't see anything that's glaring from the definition. I realize the truly only hot deployable directory is the deploy directory so I'm not sure how I was able to get configuration files to hot deploy fron the conf directory on my staging server. Again, all of my problems arise when I attempt to hot deploy my property files in a JAR on one of the production machines. I'm going to actually reboot the production machine and build it exactly like the staging server to see if I can replicate the environment exactly. I'm also going to kill Apache so no requests hit the machine. Right now I'm really baffled. Could this be a bug that's been fixed in 3.2.6? I haven't tried using RC1 on the production server and I'm aware of the "NPE when redeploying root context" bug [973565] that has been fixed in 3.2.6 and I'm not sure if there is any correlation. Thanks again for any help.

              • 4. Re: Hot Deployable Property Files
                Ricardo Cortes Newbie

                I think I might have found a bug but I want to check here first before submitting the bug on SF.net. After some more testing I finally figured out why I am not able to hot deploy on my production machines but I'm able to do so on my staging environment. Actually, the hot deploy works fine but the changes in the property file (located in the hot deployed JAR) don't get recognized if the machine has any active sessions on it. To test this out I turned off Apache so no requests would hit the JBoss instance and let the production machine expire all of it's active sessions (about 1500). As soon as the last session was destroyed, I started Apache again and Voila!, the change from the property file was recognized. Can someone tell me if this a bug? I would imagine it is but what relationship is there between the active sessions on a machine and how hot deployment actually works? Thanks for any and all input...

                Environment: 3.2.5 and 3.2.6RC1 on Linux

                • 5. Re: Hot Deployable Property Files
                  Scott Stark Master

                  This sounds like an issue which how the properties are being read. Describe the full lifecycle of the properties through redeployment.

                  • 6. Re: Hot Deployable Property Files
                    Ricardo Cortes Newbie

                    We have an Ant task that creates a properties.jar file with one file in it (a properties file) and copies the created JAR to the deploy folder. The deploy folder is listed in the jboss-service.xml file as a valid URL within the URLDeploymentScanner MBean. When the JBoss system is started, everything works just fine. We read the property values from our properties file using the following method in our PropertyManager class:

                     public static String valueForPropertyFromDomainWithLocale(String aProperty, String aDomain, Locale aLocale) {
                     try {
                     ResourceBundle properties = ResourceBundle.getBundle(aDomain, aLocale);
                     for (Enumeration enum = properties.getKeys();enum.hasMoreElements();) {
                     String propertyKey = (String)enum.nextElement();
                     if (propertyKey.equals(aProperty)) {
                     return (String)properties.getObject(aProperty);
                     }
                     }
                     }
                     catch (MissingResourceException e) {
                     LogFactory.getLog("PropertyManager").warn("Unable to locate property file named "+aDomain+".", e);
                     }
                     return null;
                     }
                    


                    We would like to change the values of the attributes in the properties file and then run the Ant task to rebuild and redeploy the properties JAR while the server is running. When I attempt to rebuild and redeploy the JAR on my staging server everything works just fine. The PropertyManager class returns the new values for our properties. However, when I try to hot deploy the properties JAR on a server with any amount of active sessions it doesn't work. Could it be that ResourceBundle is not the correct approach to loading the modified property file?


                    • 7. Re: Hot Deployable Property Files
                      Ricardo Cortes Newbie

                      Shall I file a bug report?

                      • 8. Re: Hot Deployable Property Files
                        Scott Stark Master

                        This does not explain how the valueForPropertyFromDomainWithLocale call is used. There is no reason I can see that an active web session should affect what value is being returned from this method unless its somehow triggering caching behavior at the ResourceBundle level. You'll have to debug why this is the case before I would consider this a jboss issue.

                        • 9. Re: Hot Deployable Property Files
                          Pratik Surti Newbie

                          Hey,

                           

                          Sorry for opening this post after long time.

                           

                          I am using jboss application server 5.1.0.GA on windows machine and facing the same issue mention above. My Flex UI doen't reflect, If I make some changes to property file and try to re-deploy. It hot deploys the other portion of EAR file like class file, xml file.

                           

                          Even I have the problem with hot-deploy but it is not the major issue right now. I am updating the EAR file from admin console. But replacing the EAR file from admin console redeploys other portions excepting the properties file.

                           

                          Could you please let me know if the problem is already resolved and How ?

                           

                          Regards,

                          Pratik