Frequently asked questions relating to WLST tend to fall into three categories: General WLST questions, Jython support questions and using WLST questions.

General WLST

General questions about WLST are addressed.

What is the relationship between WLST and the existing WebLogic Server command-line utilities, such as wlconfig and weblogic.Deployer?

WLST functionality includes the capabilities of the following WebLogic Server command-line utilities:

When would I choose to use WLST over the other command-line utilities or the WebLogic Server Administration Console?

You can create, configure, and manage WebLogic domains using WLST, command-line utilities, and the WebLogic Server Administration Console interchangeably. The method that you choose depends on whether you prefer using a graphical or command-line interface, and whether you can automate your tasks by using a script.

What is the distinction between WLST online and offline?

You can use WLST online (connected to a running Administration Server or Managed Server instance) and offline (not connected to a running server).

WLST online interacts with an active WebLogic domain and provides simplified access to Managed Beans (MBeans), WebLogic Server Java objects that you can also manage through JMX. Online, WLST provides access to information that is persisted as part of the internal representation of the configuration.

WLST offline enables you to create a new WebLogic domain or update an existing WebLogic domain without connecting to a running WebLogic Server—supporting the same functionality as the Configuration Wizard. Offline, WLST only provides access to information that is persisted in the config directory.

Jython Support

WLST supports Jython.

What version of Jython is used by WLST?

The WLST scripting environment is based on the Java scripting interpreter, Jython 2.2.1.

Can I run regular Jython scripts from within WLST?

Yes. WebLogic Server developers and administrators can extend the WebLogic scripting language to suit their environmental needs by following the Jython language syntax. See http://www.jython.org.

Using WLST

General questions about using WLST are addressed.

If I have SSL or the administration port enabled for my server, how do I connect using WLST?

To connect to a WebLogic Server instance through an SSL listen port on a server that is using the demonstration SSL keys and certificates, invoke WLST using the following command:

java -Dweblogic.security.SSL.ignoreHostnameVerification=true -Dweblogic.security.TrustKeyStore=DemoTrust weblogic.WLST

Otherwise, at a command prompt, enter the following command:

java weblogic.WLST

In the event of an error, can I control whether WLST continues or exits?

Yes, using the exitonerror variable. Set this variable to true to specify that execution should exit when WLST encounters an error, or to false to continue execution. This variable defaults to true. See WLST Variable Reference in WLST Command Reference for WebLogic Server.

Why do I have to specify (and) after each command, and enclose arguments in single- or double-quotes?

This is the proper Jython syntax. See http://www.jython.org.

Can I start a server, deploy applications, and then shut down the server using WLST?

Yes, see the documentation for the following groups of WLST commands:

Can WLST connect to a Managed Server?

Yes. You can connect to a Managed Server using the connect command. While connected to a Managed Server, you can view run-time data for the server and manage the security data that is in your Authentication provider's data store (for example, you can add and remove users). You cannot modify the WebLogic domain's configuration. See connect in WLST Command Reference for WebLogic Server.

Can WLST use variables that I define in a properties file?

Yes. You can use the loadProperties command to load your variables and values from a properties file. When you use the variables in your script, during execution, the variables are replaced with the actual values from the properties file. See loadProperties in WLST Command Reference for WebLogic Server.

Does the configToScript command convert security MBeans in config.xml?

Yes, the security MBeans are converted. However, the information within the Embedded LDAP is not converted.

How can I access custom MBeans that are registered in the WebLogic MBeanServer?

To navigate to the custom MBean hierarchy on the Runtime MBean Server, use the custom command. To navigate to the custom MBean hierarchy on the Domain Runtime MBean Server, use the domainCustom command. See Tree Commands in WLST Command Reference for WebLogic Server.

Why am I not seeing all the MBeans that are registered in the MBeanServer?

There are internal and undocumented MBeans that are not shown by WLST.

Why does WLST offline not display the same MBeans as WLST online?

As a performance optimization, WebLogic Server does not store most of its default values in the WebLogic domain's configuration files. In some cases, this optimization prevents entire management objects from being displayed by WLST offline (because WebLogic Server has never written the corresponding XML elements to the WebLogic domain's configuration files). For example, if you never modify the default logging severity level for a WebLogic domain while the domain is active, WLST offline will not display the domain's Log management object.

If you want to change the default value of attributes whose management object is not displayed by WLST offline, you must first use the create command to create the management object. Then you can cd to the management object and change the attribute value. See create in WLST Command Reference for WebLogic Server.

When browsing custom MBeans, why do I get the following error message: No stub Available?

When browsing the custom MBeans, the cmo variable is not available.

Can I connect to a WebLogic Server instance through HTTP?

If you are connecting to a WebLogic Server instance through HTTP, ensure that the TunnelingEnabled attribute is set to true for the WebLogic Server instance. See TunnelingEnabled in MBean Reference for Oracle WebLogic Server.

Can I invoke WLST through Ant?

Yes, you can initiate a new weblogic.WLST process inside an Ant script and pass your script file as an argument.

Can WLST scripts execute on the server side?

Yes. You can create an instance of the WLST interpreter in your Java code and use it to run WLST commands and scripts. You can then call the WLST scripts as a startup class or as part of ejbCreate so that they execute on the server side. See Embedded Mode.

Can I customize WLST?

Yes. You can update the WLST home directory to define custom WLST commands, WLST commands within a library, and WLST commands as a Jython module. For more information, see Customizing WLST.

How do I execute custom WLST commands?

You execute custom WLST commands in the same way as WebLogic Server WLST commands. Once you define custom commands in a .py file, they are available for use from the WLST command line and within scripts.

Similarly, if you have installed Fusion Middleware (FMW) components that include custom WLST commands, the commands are available for use from the WLST command line or within scripts.

For pointers to the documentation for the custom WLST commands, see Related Documentation in WLST Command Reference for WebLogic Server.

You can display help for these commands by entering the help(), help('commandGroup'), and help('commandName') commands on the WLST command line.

Import wlstModule for Modularity

Importing wlstModule in your WLST scripts allow the script to be run directly or imported without an error.

WLST provides a set of functions and global variables for WLST scripts to use for working with the WebLogic Server MBean servers. Although, basic scripts and command-line allow the use of these functions directly, using this method in your WLST scripts reduces their modularity.

There might be scenarios where data center operations staff are not allowed to access WebLogic Server administrative functions requiring the administrator credentials directly, but instead requires the use of provided WLST scripts. Another scenario, where you are a WLST script developer and have devised a secure way to retrieve the administrator credentials and connect to the production Admin Server. Following is an example:

adminUrl = sys.argv[1]
wlUser = ... # secure retrieval of admin user
wlPassword = ... # secure retrieval of admin password

connect(wlUser, wlPassword, adminUrl)

This works when you embed it directly in your test script. Now, you want to factor this code out into its own WLST PY function that other scripts use and not copy. To achieve this in Jython, you must create a function in a PY file that your other scripts import. The first step is to move this into a function inside your test script, as shown in the following example:

def wlsConnect(adminUrl):
    wlUser = ... # secure retrieval of admin user
    wlPassword = ... # secure retrieval of admin password
    connect(wlUser, wlPassword, adminUrl)

The next step is to move the function and others into their own PY file that can be imported into other scripts. Maybe you have created a wlsAdminUtils.py file and added your function to it. Now, you can achieve this in all of your scripts that require an administrative connection to the server.

import wlsAdminUtils
wlAdminUrl = sys.argv[1]

However, when you try to run your new script, you get an error Jython NameError: connect pointing to the call to the WLST connect() function in your wlsAdminUtils.py-defined wlsConnect function. This is because the code is now running in a different context, due to the import. To fix and allow the function to run in any context you need to import the wlstModule and use it to qualify the name of the WLST functions. Following is an example:

import wlstModule as wlst

def wlsConnect(adminUrl):
    wlUser = ... # secure retrieval of admin user
    wlPassword = ... # secure retrieval of admin password
    wlst.connect(wlUser, wlPassword, adminUrl)

This ensures that your WLST scripts allow the script to be run directly or imported without an error.