3 Replies Latest reply on Sep 11, 2007 6:56 AM by Renen W

    Properties File

    Renen W Newbie

      Hello, I have a JBoss 4.0.5 server hosting three applications. I would like to be able to use a properties file to control certain basic configuration settings for each app. I can easily access a config file, but the apps look in the jboss-4.0.5/bin directory. Short of hard coding a path (which would be self-defeating), how do I point the application servers at their own configs?

      Or, am I on the wrong track completely and is there a better approach?

      Thanks in advance for your input.

        • 1. Re: Properties File
          Peter Johnson Master

          I assume that you want to have one properties file that controls all three apps. Use a system property, such as jboss.server.config.url or jboss.server.data.dir, to get the absolute location of the server/xxx/config or server/xx/data directory, and place your properties file there.

          • 3. Re: Properties File
            Renen W Newbie

            Just to follow that up. The following code will open a property file and read a property:

            String confFile = System.getProperty("jboss.server.config.url") + confFilename;
            System.out.println("Will look for configuration settings in: " + confFile);
            URL url = new URL(confFile);
            defaultProperties = new Properties();
            defaultProperties.load(url.openStream());
            queryTIMEOUT = Integer.parseInt(defaultProperties.getProperty("QueryTimeout", Integer.toString(defaultQueryTIMEOUT) ));
            


            Hope somebody finds this useful.