WLS MBeans

WLS provides a set of Managed Beans (MBeans) to configure, monitor and manage WLS resources. We can use the WLS MBeans to automate some of the tasks related to the configuration and maintenance of the WLS instance. The MBeans can be accessed a number of ways; using various UIs and programmatically using Java or WLST Python scripts.

For customization development we can use the features to e.g. manage the deployed customization in MDS, control logging levels, automate deployment of dependent libraries etc. This article is an introduction on how to access and use the WLS MBeans. The goal is to illustrate the various access methods in a single article; the details of the features are left to the linked documentation.

This article covers Windows based environment, steps for Linux would be similar however there would be some differences e.g. on how the file paths are defined.


The WLS MBeans can be categorized to runtime and configuration MBeans.

The Runtime MBeans can be used to access the runtime information about the server and its resources. The data from runtime beans is only available while the server is running. The runtime beans can be used to e.g. check the state of the server or deployment.

The Configuration MBeans contain information about the configuration of servers and resources. The configuration of the domain is stored in the config.xml file and the configuration MBeans can be used to access and modify the configuration data. For more information on the WLS MBeans refer to:

Java Management Extensions (JMX)

We can use JMX APIs to access the WLS MBeans. This allows us to create Java programs to configure, monitor, and manage WLS resources. In order to use the WLS MBeans we need to add the following library into the class-path:

Connecting to a WLS MBean server

The WLS MBeans are contained in a Mbean server, depending on the requirement we can connect to (MBean Server / JNDI Name):

  • Domain Runtime MBean Server
    • weblogic.management.mbeanservers.domainruntime
  • Runtime MBean Server
    • weblogic.management.mbeanservers.runtime
  • Edit MBean Server
    • weblogic.management.mbeanservers.edit

To connect to the WLS MBean server first we need to create a map containing the credentials;

Hashtable<String, String> param = new Hashtable<String, String>();

param.put(Context.SECURITY_PRINCIPAL, "weblogic");       

param.put(Context.SECURITY_CREDENTIALS, "weblogic1");       



These define the user, password and package containing the protocol. Next we create the connection:

JMXServiceURL serviceURL =

    new JMXServiceURL("t3","",7101,


JMXConnector connector = JMXConnectorFactory.connect(serviceURL, param); MBeanServerConnection connection = connector.getMBeanServerConnection();

With the connection we can now access the MBeans for the WLS instance. For a complete example see Appendix A of this post. For more details refer to Accessing WebLogic Server MBeans with JMX

Accessing WLS MBeans

The WLS MBeans are structured hierarchically; in order to access content we need to know the path to the MBean we are interested in. The MBean is accessed using “MBeanServerConnection. getAttribute” API.  WLS provides entry points to the hierarchy allowing us to navigate all the WLS MBeans in the hierarchy (MBean Server / JMX object name):

  • Domain Runtime MBean Server
    • com.bea:Name=DomainRuntimeService,Type=weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean
  • Runtime MBean Servers
    • com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean
  • Edit MBean Server
    • com.bea:Name=EditService,Type=weblogic.management.mbeanservers.edit.EditServiceMBean

For example we can access the Domain Runtime MBean using:

ObjectName service = new ObjectName(

"com.bea:Name=DomainRuntimeService," +


Same syntax works for any “child” WLS MBeans e.g. to find out all application deployments we can:

ObjectName domainConfig =


ObjectName[] appDeployments = (ObjectName[])connection.getAttribute(domainConfig,"AppDeployments");

Alternatively we could access the same MBean using the full syntax:

ObjectName domainConfig = new ObjectName("com.bea:Location=DefaultDomain,Name=DefaultDomain,Type=Domain");

ObjectName[] appDeployments =



For more details refer to Accessing WebLogic Server MBeans with JMX

Invoking operations on WLS MBeans

The WLS MBean operations can be invoked with MBeanServerConnection. invoke API; in the following example we query the state of “AppsLoggerService” application:

ObjectName appRuntimeStateRuntime = new ObjectName("com.bea:Name=AppRuntimeStateRuntime,Type=AppRuntimeStateRuntime");

Object[] parameters = { "AppsLoggerService", "DefaultServer" };

String[] signature = { "java.lang.String", "java.lang.String" };

String result = (String)connection.invoke(appRuntimeStateRuntime,"getCurrentState",parameters, signature);

The result returned should be "STATE_ACTIVE" assuming the "AppsLoggerService" application is up and running.

WebLogic Scripting Tool (WLST)

The WebLogic Scripting Tool (WLST) is a command-line scripting environment that we can access the same WLS MBeans. The tool is located under:


Do note that there are several instances of the wlst script under the $MW_HOME, each of them works, however the commands available vary, so we want to use the one under “oracle_common”. The tool is started in offline mode. In offline mode we can access and manipulate the domain configuration. In online mode we can access the runtime information. We connect to the Administration Server :

connect("weblogic","weblogic1", "t3://")

In both online and offline modes we can navigate the WLS MBean using commands like "ls" to print content and "cd" to navigate between objects, for example:

WLST command shell

All the commands available can be obtained with:


For details of the tool refer to WebLogic Scripting Tool and for the commands available WLST Command and Variable Reference. Also do note that the WLST tool can be invoked from Java code in Embedded Mode.

Running Scripts

The WLST tool allows us to automate tasks using Python scripts in Script Mode. The script can be manually created or recorded by the WLST tool. Example commands of recording a script:


<commands that we want to record>


We can run the script from WLST:


We can also run the script from the command line:

C:\apps\Oracle\Middleware\oracle_common\common\bin\wlst.cmd c:/temp/recording.py

There are various sample scripts are provided with the WLS instance.

UI to Access the WLS MBeans

There are various UIs through which we can access the WLS MBeans.

In the integrated JDeveloper environment only the Oracle WebLogic Server Administration Console is available to us. For more information refer to the documentation, one noteworthy feature in the console is the ability to record WLST scripts based on the navigation.

In addition to the UIs above the JConsole included in the JDK can be used to access the WLS MBeans. The JConsole needs to be started with specific parameter to force WLS objects to be used and jar files in the classpath:

"C:\apps\Oracle\Middleware\jdk160_24\bin\jconsole" -J-Djava.class.path=C:\apps\Oracle\Middleware\jdk160_24\lib\jconsole.jar;C:\apps\Oracle\Middleware\jdk160_24\lib\tools.jar;C:\apps\Oracle\Middleware\wlserver_10.3\server\lib\wljmxclient.jar -J-Djmx.remote.protocol.provider.pkgs=weblogic.management.remote

For more details refer to the Accessing Custom MBeans from JConsole.


In this article we have covered various ways we can access and use the WLS MBeans in context of integrated WLS in JDeveloper to be used for Fusion Application customization development.


Appendix A

package oracle.apps.test;

import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Hashtable;
import javax.management.MBeanServerConnection;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
import javax.naming.Context;

 * This class contains simple examples on how to access WLS MBeans using JMX.
public class BlogExample {

     * Connection to the WLS MBeans
    private MBeanServerConnection connection;
     * Constructor that takes in the connection information for the
     * domain and obtains the resources from WLS MBeans using JMX.
     * @param hostName host name to connect to for the WLS server
     * @param port port to connect to for the WLS server
     * @param userName user name to connect to for the WLS server
     * @param password password to connect to for the WLS server
    public BlogExample(String hostName, String port, String userName,
                       String password) {
        try {
            initConnection(hostName, port, userName, password);
        } catch (Exception e) {
            throw new RuntimeException("Unable to connect to the domain " +
                                       hostName + ":" + port);

     * Default constructor.
     * Tries to create connection with default values. Runtime exception will be
     * thrown if the default values are not used in the local instance.
    public BlogExample() {
        this("", "7101", "weblogic", "weblogic1");

     * Initializes the JMX connection to the WLS Beans
     * @param hostName host name to connect to for the WLS server
     * @param port port to connect to for the WLS server
     * @param userName user name to connect to for the WLS server
     * @param password password to connect to for the WLS server
     * @throws IOException error connecting to the WLS MBeans
     * @throws MalformedURLException error connecting to the WLS MBeans
     * @throws MalformedObjectNameException error connecting to the WLS MBeans
    private void initConnection(String hostName, String port, String userName,
                                String password)
                                throws IOException, MalformedURLException,
                                       MalformedObjectNameException {
        String protocol = "t3";
        String jndiroot = "/jndi/";
        String mserver = "weblogic.management.mbeanservers.domainruntime";
        JMXServiceURL serviceURL =
            new JMXServiceURL(protocol, hostName, Integer.valueOf(port),
                              jndiroot + mserver);
        Hashtable<String, String> h = new Hashtable<String, String>();
        h.put(Context.SECURITY_PRINCIPAL, userName);
        h.put(Context.SECURITY_CREDENTIALS, password);
        JMXConnector connector = JMXConnectorFactory.connect(serviceURL, h);
        connection = connector.getMBeanServerConnection();

     * Main method used to invoke the logic for testing
     * @param args arguments passed to the program
    public static void main(String[] args) {
        BlogExample blogExample = new BlogExample();

     * Example of using an entry point to navigate the WLS MBean hierarchy.
    public void testEntryPoint() {
        try {
            ObjectName service =
             new ObjectName("com.bea:Name=DomainRuntimeService,Type=" +
            ObjectName domainConfig =
            ObjectName[] appDeployments =
            for (ObjectName appDeployment : appDeployments) {
                String resourceIdentifier =
        } catch (Exception e) {
            throw new RuntimeException(e);

     * Example of accessing WLS MBean directly with a full reference.
     * This does the same thing as testEntryPoint in slightly difference way.
    public void testDirectAccess() {
        try {
            ObjectName appDeployment =
                new ObjectName("com.bea:Location=DefaultDomain,"+
            String resourceIdentifier =
                (String)connection.getAttribute(appDeployment, "SourcePath");
        } catch (Exception e) {
            throw new RuntimeException(e);

     * Example of invoking operation on a WLS MBean.
    public void testInvokeOperation() {
        try {
            ObjectName appRuntimeStateRuntime =
                new ObjectName("com.bea:Name=AppRuntimeStateRuntime,"+
            String identifier = "AppsLoggerService";
            String serverName = "DefaultServer";
            Object[] parameters = { identifier, serverName };
            String[] signature = { "java.lang.String", "java.lang.String" };
            String result =
                (String)connection.invoke(appRuntimeStateRuntime, "getCurrentState",
                                          parameters, signature);
            System.out.println("State of " + identifier + " = " + result);
        } catch (Exception e) {
            throw new RuntimeException(e);


Post a Comment:
  • HTML Syntax: NOT allowed

Follow us on twitter Fusion Applications Extensibility, Customizations and Integration forum Fusion Applications Dev Relations YouTube Channel
This blog offers news, tips and information for developers building extensions, customizations and integrations for Oracle Fusion Applications.


« July 2016