6 Replies Latest reply on Sep 13, 2005 5:55 PM by javadeveloper30

    Location to definer application specific properties

    javadeveloper30

      hello All,

      Where can you define an application specific property in JBoss. Currently I have defined it in jboss/bin/run.sh as an additonal JBoss specific property as follows :
      #Setup JBoss specific properties
      JAVA_OPTS="$JAVA_OPTS -Dprogram.name=$PROGNAME"
      JAVA_OPTS="$JAVA_OPTS -Dmyprop=mypropvalue"

      Although this works, I want to define it in a more appropriate location in JBoss.
      Any help ?

      Thanks in advance.

        • 1. Re: Location to definer application specific properties
          adellechiaie

          You can use the System Properties Service. It's very easy and useful.
          You'll find the file in your server\deploy directory called: properties-service.xml
          In the attribute URLList you can specify a list of files/URLs where you can put your application-level properties.
          If you need to change the application-level properties, you have only to change it in the file/URL specified in the properties-service.xml and touch it, and JBoss will stop and restart the System Properties Service with the new properties.
          Ciao

          • 2. Re: Location to definer application specific properties
            javadeveloper30

            great it works. thanks for the help.

            Another question, I' have several server instances and I am refering to the server name in my system property value. Is there any way I can dynamically pick up the server instance name and use it in the system property value ? This way I will not have to change the server name in property value for each server instance .
            eg ABCProp=/usr/jboss-4.0.2/server/server_name/abc

            Can server_name be dynamically picked up ?

            • 3. Re: Location to definer application specific properties
              adellechiaie

              Sure, look at the http://localhost:8080/web-console
              and click on "System" in the java applet and you'll find all the JBoss System Properties.
              The system property "jboss.server.name" contains the name of the configuration that is running.
              Ciao

              • 4. Re: Location to definer application specific properties
                javadeveloper30

                Thanks but how to I refer to this in my property value. I tried $jboss.server.name as follows but it doesn't seem to be working

                abcprop = /usr/jboss-4.0.2/server/$jboss.server.name/abc

                • 5. Re: Location to definer application specific properties
                  adellechiaie

                   

                  "javadeveloper30" wrote:
                  Thanks but how to I refer to this in my property value. I tried $jboss.server.name as follows but it doesn't seem to be working

                  abcprop = /usr/jboss-4.0.2/server/$jboss.server.name/abc

                  OK, I understand but I really don't know this... you could try

                  abcprop = /usr/jboss-4.0.2/server/${jboss.server.name}/abc

                  or, if it doesn't work, do something like this:
                  define the property
                  abcprop = abc
                  and then

                  String jBossDir = System.getProperty("jboss.server.dir");
                  String jBossServerName = System.getProperty("jboss.server.name");
                  String myProperty = System.getProperty("abcprop");

                  String total = jBossDir;
                  total += System.getProperty("file.separator");
                  total += jBossServerName;
                  total += System.getProperty("file.separator");
                  total += myProperty;
                  And you'll have:
                  /usr/jboss-4.0.2/server/MY_SERVER_NAME/abc

                  Ciao

                  • 6. Re: Location to definer application specific properties
                    javadeveloper30

                    the first option does not work. For now I'll just hardcode the server instance name and include it as a point in the deployment instructions.
                    thanks for all the help.