About
The execution of a Wlst Script can happen in the following three modes:
- interactive: on the command line
- scripting: in batch scripts that are supplied in a file (Script Mode, where scripts invoke a sequence of WLST commands without requiring your input)
- embedded: in Java code.
Articles Related
How to
start the WLST console
From a shell with Java
- Environment Configuration
Environment variable | Path |
---|---|
CLASSPATH | WebLogic Server classes |
PATH | WL_HOME\server\bin |
Script to set both variables:
- Windows: WL_HOME\server\bin\setWLSEnv.cmd
- Linux: WL_HOME\server\bin\setWLSEnv.sh
- Invoking the console Console
java
[ -Dweblogic.security.SSL.ignoreHostnameVerification=true -Dweblogic.security.TrustKeyStore=DemoTrust ]
weblogic.WLST
[ -loadProperties propertyFilename ]
[ -skipWLSModuleScanning ]
[ [-i] filePath.py ]
where:
- the first parameter is for a SSL connection
- the second option is to load a property file
- -skipWLSModuleScanning is to reduce startup time by skipping package scanning and caching for WLS modules
- -i prevent WLST from exiting after the script is executed
- filePath.py is a script
Example:
C:\Oracle\Middleware1035\wlserver_10.3\server\bin>java weblogic.WLST
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
wls:/offline>
From a shell script
This wlst.cmd:
FMW_HOME\oracle_common\common\bin\wlst.cmd
calls this one:
FMW_HOME\wlserver_10.3\common\bin\wlst.cmd
From Windows Start Menu: Weblogic Scripting Tool
From Eclipse
Start an “Hello World” script
The script:
import sys
if len(sys.argv) > 1:
print sys.argv[1]+" from the console"
else:
print "Hello World from the script"
From the shell
java weblogic.WLST HelloWorld.py "Hello World"
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Hello World from the console
From Eclipse
From the WLST console
import sys
sys.argv = ['Hello World', 'arg2']
execfile('HelloWorld.py')
From Ant
<property name="wls.lib.dir" location="C:/Oracle/Middleware1035/wlserver_10.3/server/lib" />
<path id="wls.classpath.id">
<pathelement location="${wls.lib.dir}/weblogic.jar" />
</path>
<taskdef name="wlst" classname="weblogic.ant.taskdefs.management.WLSTTask" classpathref="wls.classpath.id" />
<target name="WlsHelloWorld">
<wlst fileName="helloworld.py" classpathref="wls.classpath.id" arguments="'Hello World'"/>
</target>
ant WlsHelloWorld
Buildfile: D:\HelloWorld\build.xml
WlsHelloWorld:
[wlst] 'Hello from the console
BUILD SUCCESSFUL
Total time: 3 seconds
Support
taskdef class weblogic.ant.taskdefs.management.WLSTTask cannot be found
taskdef class weblogic.ant.taskdefs.management.WLSTTask cannot be found
using the classloader AntClassLoader[]
The classpath element must be added to the taskdef.
<taskdef name="wlst" classname="weblogic.ant.taskdefs.management.WLSTTask" classpathref="wls.classpath.id"/>