3 Replies Latest reply on Apr 29, 2009 12:49 AM by jaikiran pai

    JBoss application deployment - Handling properties outside o

    Tal S Newbie

      Hi,

      We are currently migrating our application into JBoss 5.0.1.GA application server (currently running on Weblogic).

      In our application we use several ear files per server, each points to a separate properties directory that exists out of the ear file but is in use only by the specific application deployed in each ear.

      We encountered some problems to configure the JBoss server the same way: When we put the properties folder outside of the ear directory (we currently use ear directory structure and not .ear file) the resources in the properties directory are not 'seen' upon server load.

      We also cannot put the properties directory in the classpath as each ear file uses properties with same name so it needs to be a solution that will be set per each ear file (directory).

      Does anybody had any experience with such implementation?

        • 1. Re: JBoss application deployment - Handling properties outsi
          jaikiran pai Master

          What is the reason for keeping these properties outside the .ear? Is it because you will have to unzip the archive to make any changes to the properties? If yes, then have a look at the exploded deployment option http://www.jboss.org/community/docs/DOC-9719. That way you can include the properties within each ear and don't have to worry about unzipping the ear for doing any changes.

          • 2. Re: JBoss application deployment - Handling properties outsi
            Tal S Newbie

             

            "jaikiran" wrote:
            What is the reason for keeping these properties outside the .ear? Is it because you will have to unzip the archive to make any changes to the properties? If yes, then have a look at the exploded deployment option http://www.jboss.org/community/docs/DOC-9719. That way you can include the properties within each ear and don't have to worry about unzipping the ear for doing any changes.


            Currently our application (deployed on Weblogic) is deployed in a way that many configuration files are outside of the ear file. Also some properties related to environment issues such hosts and ports. We would like to deploy same strucrue in JBoss if possible. Is there a way to stay with this structure in JBoss. We noticed that we can't access files outside of the ear file.

            • 3. Re: JBoss application deployment - Handling properties outsi
              jaikiran pai Master

              You can place those property files in %JBOSS_HOME%/server/< serverName>/conf folder which by default is in the classpath. You can then access those files in the code, something along these lines:

              InputStream is = this.getClass().getClassLoader().getResourceAsStream("myprops.properties);
              Properties props = new Properties();
              props.load(is);
              


              But obviously, you cannot have multiple versions of the same file on the same server instance (that's what i thought your original requirement was - one version per ear on the same server instance).