Tuesday 25 November 2014

Weblogic Admin Utility - How to use it to start or stop a weblogic Managed Server

Hi Guys,

Weblogic Admin is a very useful utility that can be used to fine the State for the WebLogic JVM and also to start and stop the JVM from backend without going to the console.
It can also be used to automate the weblogic JVM bounces that you might need to perform if you are reading this post

How to use Weblogic Admin Utility

The weblogic admin utility is a java command that uses weblogic.jar file that comes with the Weblogic installation so that first step is to locate the weblogic.jar file

Note: Below command may not run if you have not set the classpath to point to the weblogic.jar file. Please set the classpath before running this command.

Once you have located the weblogic.jar file, below is the syntax for using this command-


1. To file the state of the Weblogic JVM

GETSTATE
java [ SSL Arguments ] weblogic.Admin
     [ Connection Arguments ]
     [ User Credentials Arguments ]
   GETSTATE [targetServer]
Argument

Definition: targetServer - The name of the server for which you want to retrieve the current state.

If you do not specify a value, the command returns the state of the server that you specified in the -url argument.

Example
The following example returns the state of a WebLogic Server instance that runs on a machine named AdminHost:
java weblogic.Admin
    -url AdminHost:7001
    -username weblogic
    -password weblogic
GETSTATE JVMName

If the command succeeds for a running server, it returns the following:
Current state of "JVMName" : RUNNING


2. To start and shutdown a weblogic instance

FORCESHUTDOWN
Terminates a server instance without waiting for active sessions to complete. For more information, refer to "Forced Shutdown" in the Configuring and Managing WebLogic Server guide.

Syntax
java [ SSL Arguments ]
   [-Dweblogic.system.BootIdentityFile=filename
     [-Dweblogic.RootDirectory=path]
   ]
   weblogic.Admin
   [ Connection Arguments ]
   [ User Credentials Arguments ]
   FORCESHUTDOWN [targetServer]


Example
The following command instructs the Administration Server to shut down a Managed Server:
java weblogic.Admin -url AdminHost:7001 -username weblogic
   -password weblogic FORCESHUTDOWN JVMName

After you issue the command, JVMName prints messages to its log file and to its standard out. The messages indicate that the server state is changing and that the shutdown sequence is starting.
If the command succeeds, the final message that the target server prints is as follows:
<Oct 12, 2002 11:28:59 AM EDT> <Alert> <WebLogicServer> <000219> <The shutdown sequence has been initiated.>

In addition, if the command succeeds, the weblogic.Admin utility returns the following:
Server "JVMName" was force shutdown successfully ...



START
Starts a Managed Server using Node Manager.
This command requires the following environment:
The domain's Administration Server must be running.
The Node Manager must be running on the Managed Server's host machine.
The Managed Server must be configured to communicate with a Node Manager.

Syntax
java [ SSL Arguments ] weblogic.Admin
   [-url URL]
   [ User Credentials Arguments ]
   START targetServer

Example
The following example instructs the Administration Server and Node Manager to start a Managed Server:
java weblogic.Admin -url AdminHost:7001 -username weblogic -password weblogic START JVMName

When you issue the command, the following occurs:
The Administration Server determines which machine JVMName is configured to run on. It instructs the Node Manager that is running on that machine to start JVMName in the state that the Start Mode field specifies.

The Node Manager indicates its progress by writing messages to its standard out. You can view these messages from the Administration Console on the Server—>Control—>Remote Start Output tab.

If the command succeeds, the weblogic.Admin utility returns to the following message:
Server "JVMName" was started ...
Please refer to server log files for completion status ... 



Please comment in case you have any questions.

No comments :

Post a Comment