[SOLVED] WLST (WebLogic Scripting Tool) – NameError

[SOLVED] WLST (WebLogic Scripting Tool) – NameError

This is a solution for an exception occurred when you try to execute a WebLogic Scripting Tool command.

You got a NameError when you try to execute WLST script. Let’s see on the example below:

You got the result like below:

The same problem may occur during execution WLST command directly from WLST console:


The spectrum of causes for this problem is quite wide. The root of them is that the command or variable used in your script has not been defined yet. Below, I presented solutions to the most common reasons for such situations.


Solution A: Variable used in the script has not been initialized yet
In the example below variable v1 has not been defined before its usage in line 2 so NameError occures;

To fix the problem try to initialize missing variable.


Solution B: Typo in the script
Look at the listing below. The intention of the author of code was to call connect method, but he made a typo and he wrote the word conect instead of the correct one.

To fix the problem try do identify possible typos and correct them.


Solution C: The sequence of executed commands is incorrect
Look at the listing below. The command stopApplication have to be call after the connect command.

To fix the problem ensure that the commands are written in the correct order;.


Solution D: Wrong WLST interpreter is used
You can find two different wlst.sh scripts in the OracleHome directory. The first one is located in the $MIDDLEWARE_HOME/wlserver_10.3/common/bin/ directory and is intended for managing of Oracle WebLogic Server. The second one is located in the $MIDDLEWARE_HOME/oracle_common/common/bin/ directory and is used for managing Oracle Middleware. Let’s look at the listing below.

Command getMDSArchiveConfig exists (is provided by) $MIDDLEWARE_HOME/oracle_common/common/bin/wlst.sh interpreter.

To fix the problem try to use $MIDDLEWARE_HOME/oracle_common/common/bin/wlst.sh interpreter instead of $MIDDLEWARE_HOME/wlserver_10.3/common/bin/wlsh.sh.



Leave a Reply

Notify of
Close Menu