Shutting Down the Server


Now that you know how to start the server and look at it using the JMX Console, you need to know how to shut it down properly. It's really pretty simple, so let's get to it.

How do I do that?

You can shut down the server in three ways:

  • Use the JMX Console to go to the jboss.system domain and choose the type=Server MBean link. On the MBean page, scroll down to the operations section and click the "Invoke" button for the shutdown( ) operation.

  • Run the shutdown script for your platform in the same directory where you found the run script.

  • Type Ctrl-c in the same console window where you started JBoss.

When JBoss is stopped, you'll see the following message:

     03:50:02,412 INFO  [Server] Shutdown complete 

You can verify that JBoss has stopped by trying to access the server in your web browser. You won't be able to connect because the server is not running anymore.

What just happened?

Just as you would expect, the application server shut down. You also learned three different ways to stop JBoss, and you got to see another useful MBean. Of those three ways, when should you use one or the other?


Note: The shutdown script is in the bin directory with the startup script! The twiddle script is a program for "twiddling" with a remote JBoss server.

In development, the Ctrl-c option is the easiest because you will likely have an open terminal window running JBoss. However, if JBoss is running as a service, especially on a remote machine, you'll need to use one of the other options. If you have shell access to the machine, the shutdown script will work fine. You can also use the shutdown command to shut down a remote JBoss instance, but this requires a local JBoss installation and a few extra command-line arguments. For remote machines, it's often more convenient to just use the JMX Console. If you keep a bookmark set to the ServerInfo MBean, it can be a very quick process. In the end, each option serves the needs of different types of users, so just choose whatever is most convenient for you.



JBoss. A Developer's Notebook
JBoss: A Developers Notebook
ISBN: 0596100078
EAN: 2147483647
Year: 2003
Pages: 106

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net