6 Replies Latest reply on May 18, 2005 12:00 PM by Scott Stark

    Shutdown of multiple instances of Jboss on same server

    John O'Grady Newbie

      This is for JBoss 4.0.2 running on Redhat ES3.

      Could someone clarify something for me? I've started multiple instances of JBoss from the command line, meaning two different configurations, each bound to it's own IP address as in the following command:

      /usr/local/jboss/bin/run.sh -Djboss.server.base.dir=/home/httpd/vhosts/ -Djboss.server.base.url=file:/home/httpd/vhosts/ --host=xxx.xxx.xxx.xxx -c mydomain.com/webapps

      Run this command twice with differing host and -c settings and you now have two instances of JBoss running from the same installed base.

      Now the problem remains, how the hell do I shutdown one instance or the other? And I mean without using kill -9?

      I know the shutdown options, which are found on http://docs.jboss.org/jbossas/jboss4guide/r3/html/ch01.html, but can't seem to get any of them to work. I tried this:
      /usr/local/jboss/bin/shutdown.sh -s xxx.xxx.xxx.xxx:1099 -S

      ...but all I get is an error:
      Exception in thread "main" javax.naming.NameNotFoundException: jmx not bound

      Now the test JBoss configurations I am using are just copies of the "minimal" configurations that come with the JBoss installation, and I think that means that JMX services are not part of that config which would explain the above error, but if that's the case, then how are you supposed to shut down a server from the command line without that service running?

      Can anyone clue me in?

        • 1. Re: Shutdown of multiple instances of Jboss on same server
          John O'Grady Newbie

          Just to add a bit to this, I've created a script for starting multiple JBoss instances on a single server. I am still working on it, as I am a beginning shell scriptor, and for the most part this is a heavily modified version of the redhat script that comes with the 4.0.2 distribution. - redhat because I am currently working on a redhat ES3 server.

          I would gladly take suggestions for this script and upload any changes for all to share. It's being housed in a Subversion repository at the following link:


          The user is "jbossusr" and the password is the same.

          I think the hell I've had to go through so far to get the right settings for relocating and starting multiple JBoss configurations, each in it's own separate JVM but sharing the same base libraries is a testiment to how virtual-hosting-hostile JBoss currently is. That said, I wouldn't have spent so much of my free time trying to get this right and learning shell scripting if I didn't like JBoss so much. Any help with this - and most importantly right now help with figuring out how to target specific running instances for shutdown, would be greatly appreciated.

          • 2. Re: Shutdown of multiple instances of Jboss on same server
            Scott Stark Master

            You will have to specify the virtual host hostile issues in more detail. The shutdown command shown is correct, so if its throwing an error you most likely do not have the jmx invoker configured.

            • 3. Re: Shutdown of multiple instances of Jboss on same server
              John O'Grady Newbie

              Hey Scott. Here's a list of the issues I've run across.

              1.) The latest documentation (http://docs.jboss.org/jbossas/jboss4guide/r3/html/ch01.html) doesn't state anywhere exactly what needs to be done to relocate a configuration folder outside the "[jboss_home]/server" directory. One glaring omission is in Figure 1.1, where "jboss.server.base.url" is listed, but is completely useless without knowing that you would also have to set "jboss.server.base.dir" to get JBoss to recognise a configuration home outside the server directory.

              2.) The current virtual host configuration for JBoss (http://docs.jboss.org/jbossas/jboss4guide/r3/html/ch9.chapt.html#d0e22095) is only good if there is only one party responsible for deploying web applications to specific domains. It would be impossible to use this in a true virtual hosting environment because it would not only require shared access to the deploy directory by all domain owners (to be able to deploy wars to their domain), but as the documentation states:

              To deploy a WAR to a specific virtual host you need to specify an appropriate virtual-host definition in your jboss-web.xml descriptor.

              ... a malicious domain owner could set the war to be deployed to someone elses domain, causing conflicts or worse. This is not to mention that two domains could not run the same application unless the application was specifically coded to handle input from two domains simultaneously.

              That covers the gist of it for now. Along the lines of feature requests, it would also be nice to allow for a shared deploy directory where a server administrator could put WARs that would be deployed to all configurations (id est - domains, virtual hosts), but would be run as if the WARs had been added to each of the configuration's deploy directories separately. Forgive me if the "all" configuration does this already. I'd check the documentation to be sure, but the "all" configuration, its purpose, and how it interacts with the other configurations is never addressed in the docs except for passing references. Googling gives me a firm "the all configuration in 4.x does the same stuff it does in 3.2.x". Gee, thanks.

              Regarding the shutdown command, I mentioned in the first post in this thread that I was using copies of the "minimal" configuration for testing, which does not have any services in the deploy directory - include the jmx related services. So are you telling me that if you want to stop a server via the command line without using kill -9, you are forced to include the jmx services in your configuration even if you do not want them?

              • 4. Re: Shutdown of multiple instances of Jboss on same server
                Scott Stark Master

                If you want to use the shutdown command, you need the jmx invoker it uses. Your free to write another mbean service which uses an alternate mechanism.

                • 5. Re: Shutdown of multiple instances of Jboss on same server
                  John O'Grady Newbie

                  What you're saying is that if you want to be able to shut down any given running instance of JBoss, you are forced to run the JMX service, whether you want it or not? Or is there some other way of targeting a server instance dirctory to specifically shut it down?

                  • 6. Re: Shutdown of multiple instances of Jboss on same server
                    Scott Stark Master

                    You can run jmx over an http invoker, custom invoker, etc. JMX is the mechanism, you need some way to provide remote access.