Search code examples
pythonbatch-fileweblogicjythonwlst

Exit WLST and continue execution of batch file


I've a batch file that does the installation of weblogic, during the setup it will invoke wlst to run some jython scripts.

The execution runs fine, but just does it doesnt exit the wlst and continue on with the rest of the bat file execution.

This is where I invoke wlst in the bat file.

echo ... Setting Path for WLST
start /wait /B %middleware%\wlserver\server\bin\setWLSEnv.cmd > /nul 2>&1

echo ... Executing WLST to create domains
%middleware%\oracle_common\common\bin\wlst.cmd %current_dir%\createdomain.py 

In the py script, exit() is called, and im stuck at this message prompt, nothing goes on after.

Exiting Weblogic Scripting Tool 

Any ideas?


Solution

  • You should call the wlst.cmd command script with command CALL like this:

    call "%middleware%\oracle_common\common\bin\wlst.cmd" "%current_dir%\createdomain.py"
    

    Same thing for the setWlsEnv.cmd. You should not start it with the START command as this runs the command script in a different command process.

    Not right is:

    start /wait /B %middleware%\wlserver\server\bin\setWLSEnv.cmd > /nul 2>&1
    

    Right would be:

    call "%middleware%\wlserver\server\bin\setWLSEnv.cmd" >nul 2>&1
    

    Please note removed / left to nul.

    A last thing, calling setWLSEnv.cmd before wlst.cmd is not required because wlst.cmd does this itself.