Oracle WebLogic Server 12c: Using the WebLogic Scripting Tool

<Do not delete this text because it is a placeholder for the generated list of "main" topics when run in a browser>

Purpose

This tutorial covers the basic use of the WebLogic Scripting Tool (WLST) to administer Oracle WebLogic Server 12c (12.1.1) via the command line.

Time to Complete

Approximately 15 minutes

Overview

The WebLogic Scripting Tool utility allows you to monitor servers from the command line. It also gives you the ability to shut down servers, change server attributes, and configure a domain. WLST also allows groups of commands to be saved in files to be able to reliably perform the same tasks many times.

This tutorial introduces you to the Oracle WebLogic Scripting Tool. It gives you a chance to practice some basic commands and to change some server properties via the command line.

Software Requirements

The following is a list of software requirements:

Prerequisites

Before starting this tutorial, you should have completed the Oracle by Example tutorial titled Oracle WebLogic Server 12c: Installing WebLogic Server and Creating a Domain.

Getting into WLST

To run the WebLogic Scripting Tool in interactive mode, perform the following steps:

.

If the administration server of the domain is not already running, it needs to be started. To start it, in a Terminal window, navigate to the domain directory, and enter the command:

$ ./startWebLogic.sh

 

When prompted for a username and password, enter the credentials of the domain administrator.

Note: The administration server does not have to be running to access WLST. However, in this tutorial, because WLST connects to the administration server, it needs to be running.

 

.

Open a new Terminal window, and navigate to the installation directory, <MIDDLEWARE_HOME>. In this tutorial it is: /u01/app/oracle/Middleware.

Then cd into the wlserver_12.1/server/bin directory under <MIDDLEWARE_HOME>.

Run the setWLSEnv.sh script to set up the environment needed for WLST as follows:

$ source setWLSEnv.sh

This sets the PATH and the CLASSPATH.

 

.

Open WLST in interactive mode by entering this command in the Terminal window:
java weblogic.WLST

 

Note: If this is the first time into WLST, you will see some extra messages about Jython performing a scan of jar files.

 

Changing a Server Property by Using WLST

To change a property of a server by using WLST in interactive mode, perform the following steps:

.

At the WLST prompt, enter the following command to connect to the running administration server:

wls:/offline> connect('<USERNAME>', '<PASSWORD>', 't3://<ADMIN_HOST>:<ADMIN_PORT>')

Replace the sample argument values with those that match your domain environment. In this tutorial, the command is:

wls:/offline> connect('weblogic', 'Welcome1', 't3://host01.example.com:8001')

 

Note the use of the proprietary protocol, t3. WLST always uses t3 (or t3s) to connect to a server.

 

.

Change to edit mode by entering the following command:

wls:/dizzyworld/serverConfig> edit()

Then start an edit session with the command:

wls:/dizzyworld/edit> startEdit()

 

.

Change to the Log directory of your administration server by using the following command:

wls:/dizzyworld/edit !> cd('Servers/<SERVER_NAME>/Log/<SERVER_NAME>')

Replace the sample argument values with those that match your domain environment. In this tutorial, the command is:

wls:/dizzyworld/edit !> cd('Servers/AdminServer/Log/AdminServer')

 

.

Set the FileCount property of the administration server log file to 8. Then use the ls() command to check whether the server property has been changed.

wls:/dizzyworld/edit/Servers/AdminServer/Log/AdminServer !> set('FileCount', '8')
wls:/dizzyworld/edit/Servers/AdminServer/Log/AdminServer !> ls()

 

.

Save and activate the changes with the following commands:

wls:/dizzyworld/edit/Servers/AdminServer/Log/AdminServer !> save()
wls:/dizzyworld/edit/Servers/AdminServer/Log/AdminServer !> activate()

 

Shutting Down the Administration Server by Using WLST

To shut down the administration server of the domain by using WLST in interactive mode, perform the following steps:

.

At the WLST prompt, enter the following command:

wls:/dizzyworld/edit/Servers/AdminServer/Log/AdminServer> shutdown()

 

Note: By default, the WLST shutdown() command shuts down the server to which you are connected.

 

.

To exit WLST, at the prompt, enter the following command:

wls:/offline> exit()

 

Summary

In this tutorial, you learned how to:

Resources

Credits

Hardware and Software Engineered to Work Together Copyright © 2011, Oracle and/or its affiliates. All rights reserved