The Confusion Chronicle

July 16, 2009

Introduction into WLST

Filed under: Computing,WebLogic Server,WLST — Tim @ 5:12 pm

WLST is the WebLogic Scripting Tool that is designed for administrating and monitoring WebLogic. It is based on the Jython programming language and it contains many unix like commands – ls(), cd(), for example.  There is an ‘offline’ and ‘online’ mode, the offline mode being primarily concerned with the administration and configuration of domains; the online mode being concerned more with the actual running of the domain, deployment of applications; monitoring of MBeans; viewing of JMS and JDBC setups. Both the offline and online modes allow for commands to be run from the WLST command line and via scripts.

The first step that is needed to allow access to the WLS environment to to run the WLST interface. The simplest way to do this is to ensure that the environment is correct by running the setDomainEnv Script within a domain, which will set the CLASSPATH and JAVA_HOME up correctly

D:\bea1030\user_projects\domains\base_domain>java -version
 java version "1.6.0_05"
 Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
 BEA JRockit(R) (build R27.6.0-50_o-100423-1.6.0_05-20080626-2105-windows-ia32, compiled mode)

Next, you’ll need to access WLST. There are more complex ways of doing this, but the easiest is this

D:\bea1030\user_projects\domains\base_domain>java weblogic.WLST

If the server is running you’ll then be able to access using the connect() command. For more detailled syntax see the connect() command in the WLST documentation

Please enter your username [weblogic] :
Please enter your password [weblogic] :
Please enter your server URL [t3://localhost:7001] :wls:/offline> connect()
Connecting to t3://localhost:7001 with userid weblogic ...
Successfully connected to Admin Server 'AdminServer' that belongs to domain 'base_domain'.

Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.

Notice the warning – it allows you to use t3 or t3s, t3s would the preferred method for production, but t3 is the default.

One undocumented option, that is not supported by all commands id the easeSyntax() command. Basically, this removes the need for tightly defined formatting or some commands, meaning that cd() becomes cd and ls() becomes ls. You turn it on

wls:/base_domain/serverConfig> easeSyntax()
You have chosen to ease syntax for some WLST commands.
However, the easy syntax should be strictly used in interactive mode. Easy syntax will not function properly in script mode and when used in loops.
You can still use the regular jython syntax although you have opted for easy syntax.
Use easeSyntax to turn this off.
Use help(easeSyntax) for commands that support easy syntax

Please note, it’s only supported in interactive mode and won’t work for scripts.

Next, you can record WLST scripts from the WLS console, whilst you do the actions in the console that are trying to record. This is REALLY useful, as it allows you view the syntax of the commands that you are trying to do, and then you can start to play with the scripts to see what you can do. It’s a very easy way of automating simple tasks.

To record hit the record button – to stop recording hit it again!

WLST Recording Button

For altering the preferences that you have, such as script name, and the folder to store it in, you can to the preferences.

WLST Preferences

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

eight × = 24