My Take on Getting Started With WebLogic Scripting Tool (WLST)

Introduction

WebLogic Scripting Tool (WLST) has been a long established favourite for experienced WebLogic Server administrators. Over the past two / three weeks I have spent time getting to know WLST - and by getting to know I mean developing a script to produce a solution rather than randomly running three or four commands :-). For the final result of my efforts, see my previous blog entry

Get an Offline or Online WebLogic Domain Summary Using WLST! 

This is a short summary of the resources I used. 

Initial reading and understanding

If you are never encountered WLST, spend a few minutes reading:

Oracle Fusion Middleware Administrator's Guide 11g Release 1 (11.1.1)
3.5.1 Getting Started Using the Oracle WebLogic Scripting Tool (WLST)

Oracle Fusion Middleware WebLogic Scripting Tool Command Reference 11g
Overview of WLST Command Categories

Unsurprisingly, you will also find yourself using the Command Reference as a look up for available commands, functionality and syntax.

WLST Code Snippets and Examples

(There are many more WLST postings (questions, examples, discussions) to be found on the web.)

Jython

WLST is based on the Java scripting interpreter, Jython and as such supports standard Jython features such as local variables, conditional variables, and flow-control statements. Therefore, to achieve something more interesting and exciting you must prepared to learn (by doing) a little Jython. Fortunately, the Jython documentation is comprehensive and provides some good examples:

Use an editor which recognizes Jython / Python

Jython (like it's "parent" language Python) is very sensitive to syntax errors. In particular, the language requires the use of indents when coding conditions (e.g IF statements) and loops. Attempt to write Jython using a plain text editor, and before long stress levels will rise. You can make life easier by using an editor which recognizes Jython. Editors like Oracle Eclipse ** and SCITE assist the developer by for example:

  • auto-formatting lines of code
  • color coding of syntax
  • providing option to show line numbers

** Eclipse requires the Python and Jython Interpreters to be configured. Instructions can be found here.

My Oracle Support Documents

And finally, if you have access to My Oracle Support, here are a few knowledge articles which provide some nice WLST examples:

  • How To Debug WLST Jython Scripts? [ID 1360744.1]
  • WLST sample script To Obtain Managed Server Status [ID 1373532.1]
  • WLST Script for monitoring and getting statistics of WebLogic JMS Destinations. [ID 1327086.1]
  • How to get JDBC and Connection Pool data from a WLST or shell script [ID 1453818.1]
  • How to Startup or Shutdown Multiple WebLogic Managed Servers With a WLST Script [ID 1383150.1]
  • How To Take Thread Dumps With WLST [ID 1274713.1]
Comments:

Hi-
I have question regarding Doc ID 1383150.1 (How to Startup or Shutdown Multiple WebLogic Managed Servers With a WLST Script).

1) while stopping the specified managed server, the script is displaying the process of shutting down..... and finally, displays managed server has been shutdown.

2) But, while using the script for starting managed server, its not displaying the status. It is simply says started managed server and script is ending.

Is there anyway we could also know the stating status and to display the managed server has been started with out exiting the script.

Thanks & regards,
TJ

Posted by guest on August 30, 2013 at 08:50 PM BST #

To the best of my knowledge, there is no WLST function which captures and prints out the different server state during the lifecycle of server startup / shutdown i.e

Diagram of the Server Life Cycle
[http://docs.oracle.com/middleware/1212/wls/START/server_life.htm#i1065205]

Instead you have to code a loop which checks the server (e.g every 5 or 10 seconds) and print out the state.

Here are some useful links which will hopefully allow you to code a solution which suits your requirements.

Oracle Documentation Example:
http://docs.oracle.com/middleware/1212/wls/WLSTG/monitoring.htm#WLSTG227

Middleware Magic Blog - Sending Email Alert for WebLogic Servers Current State
http://middlewaremagic.com/weblogic/?p=5838

WLST By Example Blog - Server State using WLST
http://docs.oracle.com/middleware/1212/wls/WLSTG/monitoring.htm#WLSTG227

Posted by Dan Mortimer on September 02, 2013 at 11:57 AM BST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

This is the blog of the Oracle Fusion Middleware Proactive Support Delivery Team. Here we will provide information about our activities, publications, product related information and more. Feedback welcome.

Follow OracleMWSupport on Twitter

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today