In order to write WebLogic scripts for automation tools such as Ansible (now – October 16, 2015 – acquired by Red Hat), we need to take care of idempotency. Before, we proceed with the scripts, we give a small introduction into the WebLogic Scripting Tool (WLST).
To enable JMX clients to control MBean life cycles, WebLogic MBeans contain operations that follow the design pattern for Java bean factory methods: for each child, a parent MBean contains a
create<MBEAN_NAME> and a
destroy<MBEAN-NAME> operation, where
<MBEAN-NAME> is the short name of the MBean’s type (the short name is the MBean’s unqualified type name without the MBean suffix, for example,
createCluster). The parent also contains a
lookup<MBEAN_NAME> operation. The
DomainMBean) is an example of a parent bean. To create a cluster, we call
createCluster(String name). To see if a cluster already has been created, we use
lookupCluster(String name). Instead of using
lookup<MBEAN_NAME>, we can also use
getMBean. In this case, we have to understand how WebLogic registers the MBeans, i.e., how the object names are structured. For example, to obtain an instance of the
ClusterMBean, we can use
1. cluster_bean_path = getPath('com.bea:Name=' + application_cluster_name + ',Type=Cluster');
2. cluster = getMBean(cluster_bean_path);
The WebLogic Scripting Tool (WLST) can be used as the command-line equivalent to the WebLogic Server Administration Console (WLST online) or as the command-line equivalent to the Configuration Wizard (WLST offline). WLST offline has a few restrictions though, one them being: "offline edits are ignored by running servers", so in the following we will be using WLST online.
The Administration Server provides some common access points: Read the complete article here.
For regular information become a member in the WebLogic Partner Community please visit: http://www.oracle.com/partners/goto/wls-emea ( OPN account required). If you need support with your account please contact the Oracle Partner Business Center.