4 Replies Latest reply on Apr 27, 2010 12:20 PM by angelodel80

    keeping properties file out of war

    angelodel80

      We've got a Seam app doing all the usual things with datasources.  Notably, pulling datasource info (url, username, password, etc.) from a  separate property file.

      Is there a way to store and source .properties  file outside of the .war? If I've got this right, Seam assumes the root of the paths used  are the root of the .war?

      But that's a bummer since installing on a new server (with a different  database) means have to explode the .war just to edit the  datasource-config file.

      How do you guys handle this situation? Or do you just live with having  to explode the .war to make config edits?

      Thanks!

      Angelo Mario

        • 1. Re: keeping properties file out of war
          pillingworth

          I have got something similar - I have a xyz.sar with a jboss-service.xml that defines an MBean that contains the properties I want to set as attributes. The war file is in the sar (and is not exploded) and I access the MBean from the war. It's not pretty or elegant but it does work.

          1 of 1 people found this helpful
          • 2. Re: keeping properties file out of war
            jaikiran

            Angelo Mario del Grosso wrote:

             

             

            Is there a way to store and source .properties  file outside of the .war? If I've got this right, Seam assumes the root of the paths used  are the root of the .war?

            I don't have experience in Seam. But I don't think Seam would rely on the war context root to find the properties file. I guess, it just uses ClassLoader.getResourceAsStream() or something along those lines. If you make available that properties file in the classpath of the application, then all should be well.

             

            Since you want to keep the properties file outside the .war and still make it available in the classpath, you could place it under JBOSS_HOME/server/< servername>/conf folder which by default is available in the classpath of the application.

            1 of 1 people found this helpful
            • 3. Re: keeping properties file out of war
              angelodel80

              Thanks Paul,

               

              could you let me watch your code solution? It is possible?

               

              I use seam, and maybe i can do what you have done in same freamework library!

              • 4. Re: keeping properties file out of war
                angelodel80

                Thanks jaikiran,

                 


                the solution you wrote it was one of my first thought!

                 


                But,like you, I not have much  experience in seam develop and its structure and library! I tryed to insert my file in conf directory, but the properties file were not read!

                 


                i.e. if a move the component.properties from WEB-INF to conf directory and I change several values, nothing happened!

                 

                any suggestion?