9 Replies Latest reply on Apr 1, 2010 9:12 AM by peterj

    Why do we need jboss.home.dir/jboss.home.url properties?

    vladimirbezugliy

      I have JBoss 4 installed on my PC to directory C:\JBoss4
      And environment  variable JBOSS_HOME set to this directory:

      JBOSS_HOME=C:\JBoss4   
      

      I need to install JBoss 5.1 on the same PC.
      I installed it into  C:\JBoss51


      In order to start JBoss 5.1 on the same host where JBoss 4 was  already started, I need to redefine properties jboss.home.dir,  jboss.home.url, jboss.service.binding.set:

      C:\JBoss51\bin\run.sh -Djboss.home.dir=C:/JBoss51 \ 
                            -Djboss.home.url=file:/C:/JBoss51 \ 
                            -Djboss.service.binding.set=ports-01 
      

      But in C:\JBoss51\bin\run.sh I can see following code:

      … 
      if [ "x$JBOSS_HOME" = "x" ]; then 
          # get the full path (without any relative bits) 
          JBOSS_HOME=`cd $DIRNAME/..; pwd` 
      fi 
      export JBOSS_HOME 
      … 
      runjar="$JBOSS_HOME/bin/run.jar" 
      JBOSS_BOOT_CLASSPATH="$runjar" 
      

      And this code does not depend either on jboss.home.dir or on  jboss.home.url.

       

      So when I start JBoss 5.1 script will use  jar files from JBoss 4.3?
      Is it correct?

       

      Should I redefine environment  variable JAVA_HOME when I start JBoss 5.1?
      In this case script will use  correct jar files.
      Or if I redefined properties jboss.home.dir,  jboss.home.url then JBoss will not use any variables set in run.sh?

       

      How does it works?

        • 1. Re: Different versions of JBoss on the same host
          peterj

          Do not set JBOSS_HOME! Let the run script set it for you. Then it will pick up the correct JARs. I have dozens of copies of JBoss AS on my PC, of various different versions, and they all run just fine - I just go to the bin directory of the one I want and run its run script. So you should run the 5.1 version like this:

           

          cd C:\JBoss51\bin
          run -Djboss.service.binding.set=ports-01

           

          And this should also work:

           

          C:\JBoss51\bin\run -Djboss.service.binding.set=ports-01 
          • 2. Re: Why do we need jboss.home.dir/jboss.home.url properties?
            vladimirbezugliy

            Unfortunately JBOSS_HOME can be set by SE team on production environment.

            And I cannot remove this environment variable.

            So I should redefine either JBOSS_HOME or jboss.home.dir/jboss.home.url properties. Or both.

             

            Now I redefining jboss.home.dir/jboss.home.url properties only.

            And I need to know - is it enough?

            Or I have to redefine environment variable JBOSS_HOME in my startup script too?

            • 3. Re: Different versions of JBoss on the same host
              peterj

              The correct solution is to tell the SE(?) team to not set JBOSS_HOME in the production environment.

               

              The  best workaround is to change the run scripts to comment out the check of whether JBOSS_HOME is already set and to always set it based on the script location:

               

              #if [ "x$JBOSS_HOME" = "x" ]; then 
                  # get the full path (without any relative bits)
                  JBOSS_HOME=`cd $DIRNAME/..; pwd`
              #fi
              export JBOSS_HOME
              • 4. Re: Why do we need jboss.home.dir/jboss.home.url properties?
                vladimirbezugliy

                I do not think that it is a good idea to modify any files from jboss_home\bin directory.

                • 5. Re: Different versions of JBoss on the same host
                  peterj

                  Well, when you refuse to use the correct solution you have to settle for a workaround.

                   

                  Try this instead. Create a new script in the bin that contains:

                   

                  JBOSS_HOME=`cd $DIRNAME/..; pwd`
                  ./run.sh
                  -Djboss.service.binding.set=ports-01

                   

                  Then tell the SE team to start the app server using that script instead of run.sh.

                   

                  By the way, are you really manually starting Jboss AS in the production environment? I would have thought that you would start it a a service/daemon.

                  • 6. Re: Why do we need jboss.home.dir/jboss.home.url properties?
                    vladimirbezugliy

                    I do not understand - why there are jboss.home.dir,  jboss.home.url properties if we can just redefine JBOSS_HOME or start jboss from directory where JBoss was installed?

                    • 7. Re: Why do we need jboss.home.dir/jboss.home.url properties?
                      peterj

                      JBOSS_HOME is used by the run scripts to locate the run,jar file.  If jboss.home.dir is not set, then the app server uses the location of run.jar to set it.. From there it sets a number of other system properties, if they were not passed on the command line. You can easily see this in the source code for org.jboss.Main.

                       

                      Therefore, you do not have to set anything - just run the run script and everything gets set automatically. Or you can set properties and override locations as you desire.

                       

                      Also, those system properties are available to apps deployed to the app server.

                      • 8. Re: Different versions of JBoss on the same host
                        vladimirbezugliy

                        What will be in case if JBOSS_HOME set to one directory but jboss.home.dir/jboss.home.url to different one?

                        Do we need such configuration in some cases?

                        • 9. Re: Different versions of JBoss on the same host
                          peterj

                          I already answered the first question. For the second question: none that I can think of.