[ Team LiB ] Previous Section Next Section

Command Examples and Scripts

For the remainder of the chapter, we illustrate how to use some commands and scripts to make it easier to administer WebLogic.

NOTE

All command examples (except where noted) in this chapter run against WebLogic Server configured in the directory F:\bea\weblogic81\server\bin. Your installation directly might be different. Most users typically install WebLogic Server in the C:\partition, so they have the WebLogic Server directory as C:\bea\weblogic81\server\bin.


The common requirement for running all commands is that the WebLogic server must be up and running.

HELP

I find HELP to be one of the most useful commands. If you forget a command or the category the command is in, do the following:

  1. Start a new command console.

  2. Set the WebLogic classpath by running setWLSEnv.cmd.

  3. Just type java weblogic.Admin.

The command window will now show the various ways you can invoke the HELP command. The good thing is you don't have to remember even the HELP command (see Figure 38.1).

Figure 38.1. Running java weblogic.Admin without any parameters.

graphics/38fig01.jpg

PING

PING is an extremely useful command. It is used to determine whether a given instance of WebLogic Server is up and running. It can detect the running servers and gives an error message in case of a failure of WebLogic administration server. If the administration server is not running, the Web-based console will not run and you cannot determine from the console (because the console doesn't run) whether the various managed servers in the domain are running. Figure 38.2 shows various ways you can run this command.

Figure 38.2. PING command issued to the administration server.

graphics/38fig02.gif

LIST

The LIST command is used to view the bindings of a node in the JNDI naming tree.

Because the default configuration of WebLogic Server does not have many objects in the JNDI tree, we run the LIST command against a sample server. This is installed in C:\bea\user_projects\medrec.

  1. Start the MedRec server with the command startMedRecServer.cmd.

  2. In a separate command window, set the classpath with the setWLSenv.cmd.

  3. Now run the following command:

    
    
    java weblogic.Admin -url t3://localhost:7001 -username
    weblogic -password weblogic LIST
    

The data returned from the LIST command will resemble the output in Figure 38.3, showing the contents of the examples program that's installed by default in WebLogic Server 8.1.

Figure 38.3. LIST command issued to the administration server.

graphics/38fig03.jpg

THREAD_DUMP

This command provides a list of the threads currently running on a Weblogic Server instance.

In a new command window, run the following command:


java weblogic.Admin -url t3://localhost:7001 -username weblogic -password weblogic THREAD_DUMP

Note that the THREAD_DUMP command prints the thread dump in the window running WebLogic Server and not in the window where the command was issued (see Figure 38.4).

Figure 38.4. THREAD_DUMP command issued to WebLogic Server.

graphics/38fig04.gif

    [ Team LiB ] Previous Section Next Section