Online WLST provides simplified access to Managed Beans (MBeans) which are Java objects that provide a management interface for an underlying resource that you can manage through JMX. Since WLST is a JMX client, all the tasks you can do using WLST online, can also be done programmatically using JMX. Start by connecting to your running Administration server:
You can also use WLST to connect to Managed Servers, but you cannot modify configuration data from Managed Servers; because this should only be done by the Administration Server which is solely responsible for maintaining, updating, and storing the configuration data.
Once you are connected to your WebLogic server instance, you can start navigating and querying MBeans. There are two main paths which can be traversed once you are connected to a WebLogic server instance: Configuration MBeans and RuntimeMBeans.
Configuration MBeans are used to explore the basic server configuration. You can navigate to configuration MBeans by using serverConfig or domainConfig (the latter one if you are connecting through the administration server):
With ls() you can have a look though this MBean structure:
Similar to the configuration information, WebLogic Server Runtime MBeans are arranged in a hierarchical data structure. When connected to an Administration Server, you can access the Runtime MBean hierarchy by entering the serverRuntime or the domainRuntime command.
The serverRuntime command places WLST at the root of the server runtime management objects - ServerRuntimeMBean;
The domainRuntime command places WLST at the root of the domain-wide runtime management objects - DomainRuntimeMBean. (The domain runtime MBean hierarchy exists on the Administration Server only).
Here’s for example how you can check health state information about one application deployed on WebLogic Server:
And now let’s issue a directory listing:
A special variable, named cmo, is set as a pointer to the bean instance you are navigate into. You can use this variable to perform any get, set, or invoke a method on the current bean instance.
Inspecting the values of MBeans is just half of your administrator activities. Within the Administration Server, there is a set of configuration MBeans in a single, editable hierarchy that contains an editable copy of all configuration MBeans in the domain and it is used only as part of the change management process.
The change management process is a controlled procedure for distributing configuration changes in a domain; a change process that loosely resembles a database transaction.
You start the editing process by obtaining a lock on the editable configuration hierarchy to prevent other people from making changes. When you finish making changes, you save and distribute them to all server instances in the domain. When you distribute changes, each server determines whether it can accept the change. If all servers are able to accept the change, they update their working hierarchy of configuration MBeans and the change is completed.
Here’s for example, how you can modify the ‘FileCount’ logging attribute
Activating all your changes may take a while; however the edit lock associated with this edit session is released once the activation is completed.
Notice the usage of thestartEdit command that initiates the editing process. Changes will not be committed to the repository until you enter the save command. The activate command initiates the distribution of the changes and releases the lock; finally notice that you can make additional changes, without re-entering the startEdit command, or undo changes you have made by entering the undo command.