2 Replies Latest reply on Dec 11, 2008 4:13 PM by dmoses48

    Restarting JBoss Programatically

    dmoses48

      Hello everyone. I have inhereted a JBoss project at work and have been fixing bugs and add enhancements on it for a few months. I have finally got permission to upgrade it from jboss 3.2.1 to jboss 4.2.2.GA.
      Our restart button on our JSP pages doesn't work anymore. I think ok they probably changed the API for the restart call. After looking at the code I'm not sure they went about this correctly to begin with.

      Currently if you press the restart button the code calls:

      log.info("Restarting application server...please wait");
      System.runFinalization();
      Runtime.getRuntime().halt(2);


      I would not expect this code to restart jboss but in 3.2.1 it does restart jboss. In 4.2.2.GA it does what I would suspect: shuts down jboss.
      So my question is, is there a way to programatically restart jboss in 4.2.2 without calling batch or shell files?

        • 1. Re: Restarting JBoss Programatically
          sanjuro

          Check the start-up script/batchfile of jboss 3.2.1. I think someone modified it to check whether the return value (errorlevel on Windows) is 2 and then restart the script.

          • 2. Re: Restarting JBoss Programatically
            dmoses48

             

            "Sanjuro" wrote:
            Check the start-up script/batchfile of jboss 3.2.1. I think someone modified it to check whether the return value (errorlevel on Windows) is 2 and then restart the script.

            In the run.bat from my jboss 3.2.1 deployment.
            if ERRORLEVEL == 2 goto RESTART

            and the run.sh from my jboss 3.2.1 deployment.
            # Error level of 2 indicates a request for restart
            errlevel=2;
            while [ $errlevel -eq 2 ]
            do
             ...Startup code...
             fi
             errlevel=$?;
             echo $errlevel
             if [ $errlevel -eq 2]
             then
             echo Restarting JBoss...
             fi
            done
            

            Thank you a bunch. I updated my shell/batch files and it works like a charm. I could have spent some time trying to figure this one out. For anyone that cares, I noticed that JBoss default run.bat for 4.2.2.GA has
            if ERRORLEVEL 10 goto RESTART