[ Team LiB ] Previous Section Next Section

Administration Commands

Accessing the command-line interface is easy. Use the following to employ the command-line interface for administering WebLogic Server 8.1.

  1. Start WebLogic Server.

  2. Open a new command-prompt window.

  3. Set the environment by navigating to and running the setWLSEnv.cmd file. This is usually located at C:\bea\weblogic81\server\bin, where C:\bea is the default installation directory (although yours might be different).

    Note that my installation directory is F:\bea\weblogic81; therefore, the command on my machine lies on the path F:\bea\weblogic81\server\bin.

    In this chapter, we work with the F: drive as the root directory. Your typical installation would be in the C: or D: drive. For running the scripts, you just replace the F: with C: (or D:).

    To avoid confusion, please note that this is not the only installation directory in WebLogic 8.1. If you chose to install samples while installing WebLogic Server, another directory where you have a WebLogic environment-setting script is

    
    
    C:\bea\weblogic81\samples\domains\examples
    

    You might also have projects in the C:\bea\user_projects directory.

    For the purpose of this chapter, we discuss the environment commands in reference to the directory C:\bea\weblogic81\server\bin. However, you could try them with any other directory.

  4. Run the WebLogic Server administration command (weblogic.Admin) from within the command-prompt window.

Syntax

The syntax for using WebLogic Server administration commands is always in the following form:

java weblogic.Admin [-url URL] -username username -password password COMMAND arguments

Where

  • URL is the listening address of the WebLogic Server. The server could either be an administration server or a managed server.

    The format is [protocol://]hostname:port. The protocol is optional and the default is t3:. The default URL is t3://localhost:7001.

  • username is the name of user running the command. The username should have the privileges to run the command. These privileges are assigned by the administrator. This parameter is mandatory.

  • password is the password associated with the username specified in the -username argument. This parameter is mandatory.

NOTE

Commands are not case-sensitive.


A NOTE ON PROTOCOL SUPPORT WHILE USING THE COMMAND-LINE INTERFACE

The url argument of the command-line interface supports t3, HTTP, t3s, HTTPS, and IIOP protocols. The default protocol used for a nonsecured port is t3. For example, the command java.Admin -url localhost:7001 is interpreted as java.Admin -url t3://localhost:7001.

For a port that is secured by Secure Sockets Layer (SSL), you can use only the t3s or HTTPS protocol.


WebLogic Server commands can be categorized in the following categories:

  • Server life cycle commands

  • Server state commands

  • JDBC connection pool commands

  • MBean management commands

  • Batch command

  • Cluster commands

The syntax for using commands is as follows:


java [-Dweblogic.security.SSL.ignoreHostnameVerifcation=true]
     [-Dweblogic.security.TrustKeyStore=DemoTrust]
     weblogic.Admin [ [-url | -adminurl] [protocol://]listen-address:port]
     -username username -password password
     COMMAND-NAME arguments

where

  • username is the name of user running the command. The username should have the privileges to run the command.

  • password is the password associated with the username specified in the -username argument.

  • COMMAND_NAME is the command to be run.

  • arguments are parameters required for the command. Some commands have optional or no parameters.

To avoid replicating what is in the documentation for WebLogic Server 8.1, we briefly mention what each command does. We also discuss scripts where such commands can be used. For an exhaustive listing, please refer to the following link:

http://e-docs.bea.com/wls/docs81/admin_ref/index.html

Server Life Cycle Commands

The commands in this category are

  • START— This command starts a managed WebLogic Server in the RUNNING mode using a node manager.

  • STARTINSTANDBY— This command starts a managed WebLogic Server in the STANDBY mode using a node manager. This command is now deprecated.

  • SHUTDOWN— This command is used to gracefully shut down an instance of WebLogic Server.

  • CANCELSHUTDOWN— This command is used to cancel the SHUTDOWN command on a WebLogic Server. It is deprecated.

  • FORCESHUTDOWN— This command is used to terminate a WebLogic Server without waiting for active sessions to complete (that is, it kills the process).

  • LOCK— This command is used to prevent nonprivileged logins on a WebLogic Server. This command can be run by the administrator only. It is deprecated.

  • UNLOCK— This command is used to unlock a WebLogic Server to allow nonprivileged logins. It is deprecated.

  • DISCOVERMANAGEDSERVER— This command is used to re-establish control by the administrative server over the managed servers. It is useful in case the administration server goes down and when it is brought up again it is unable to maintain a connection to the managed servers in the domain.

  • RESUME— This command changes the state of a WebLogic Server from STANDBY to RUNNING.

Server State Commands

The commands in this category are as follows:

  • HELP— This command is used to provide usage information about other Java weblogic.Admin commands on the console.

  • VERSION— This command gives the version of WebLogic Server.

  • PING— This command is used to verify whether a WebLogic Server is running and accepting client requests.

  • GETSTATE— This command returns the state of a WebLogic Server.

  • LIST— This command lists the various objects on node in the JNDI tree.

  • CONNECT— This command gives the roundtrip time to a WebLogic Server and the time the connection is maintained.

  • LICENSES— Used to list the license information for the given server.

  • SERVERLOG— This command displays the contents of the current log file for the given server.

  • THREAD_DUMP— This command provides a detailed list of threads currently executing on WebLogic Server.

JDBC Connection Pool Commands

The commands in this category are as follows:

  • EXISTS_POOL— Checks for the existence of a specific JDBC connection pool.

  • TEST_POOL— This command gets a connection from a JDBC connection pool and releases it.

  • CREATE_POOL— This command is used to create a JDBC connection pool.

  • RESET_POOL— This command is used to close and reopen all connections in a JDBC connection pool.

  • ENABLE_POOL— Enables a JDBC connection pool after it has been disabled. Deprecated; use RESUME_POOL instead.

  • DISABLE_POOL— Temporarily prevents clients from accessing a connection pool. Deprecated; use SUSPEND_POOL instead.

  • SUSPEND_POOL— Same as DISABLE_POOL.

  • RESUME_POOL— Same as ENABLE_POOL.

  • SHUTDOWN_POOL— Closes all connections in a JDBC pool. Afterward, the connection pool is undeployed from all target servers.

  • DELETE_POOL— Removes the connection pool from all target servers. Afterward, the connection pool is removed from the configuration.

  • DESTROY_POOL— Same as DELETE_POOL. Deprecated.

MBean Management Commands

The commands in this category are as follows:

  • CREATE— Creates an instance of an administration MBean or local configuration MBean. BEA recommends that this command not be used to create local configuration MBeans.

  • GET— Displays MBean attributes as name-value pairs and JMX object names.

  • SET— Sets a specified attribute for a configuration MBean.

  • INVOKE— Invokes a management operation on one or more MBeans.

  • QUERY— This command is used to query an MBean with a given WebLogicObjectName pattern.

  • DELETE— Deletes a given MBean.

Batch Command

There is only batch command for WebLogic Server 8.1: BATCHUPDATE. This command executes a sequence of weblogic.Admin commands that are specified in a text file.

Cluster Commands

The commands in this category are as follows:

  • CLUSTERSTATE— Returns cluster information about a WebLogic cluster.

  • STARTCLUSTER— Starts all servers in a cluster which have been configured to use a node manager.

  • STOPCLUSTER— Initiates forceful shutdown of all servers in a cluster.

  • VALIDATECLUSTERCONFIG— Validates cluster related elements in the config.xml file for the domain and reports errors that occur.

  • MIGRATE— Migrates a JMS service or a JTA transaction recovery service to a targeted server within a server cluster.

    [ Team LiB ] Previous Section Next Section