WLST domain creation using dry-runPublished on: Author: Michel Schildmeijer Category: Oracle
I’m a fan of scripting, a fan of python and WLST. Scripting makes human error less the cause of failures. If you search on the internet about scripted WebLogic domain creation, you will find many examples, but they all create a domain immediately. But what if you want to browse through your domain to check if settings you want to apply satisfy your requirements? Now, for this there is an option called dry run.
A dry-run request is similar to a normal request (validity checks of a certain operation is performed), but comitting the actual changes is on hold. In this case you’ll start a domain creation (WLST offline mode), browse through the MBean structure as if the domain is online an check or adjust settings. If you are satisfied, you can write the configuration to disk wit a simple write statement.
I have a set of scripts about the creation of a WebLogic/ OSB domain created in Production mode. Another thing to overcome is that you wiil have to create or specifiy a boot.propertes in order to start your domain.
The script components are:
- osb_properties.py — properties file with specific domain properties
- osb_domain_utility — file to load variables with python def function, plus some cmo statements
- osb.py — actual execute file with dryrun option
- nm_properties — file to set some Node manager specific settings, like StartScriptEnabled and CrashRecovery
To run the scripts
Take care that some O/S setting (Linx/UNIX are set ) as the os.getenv is expecting. The best is to set this in the WebLogic software users profile (.bash_profile, .profile)
- java weblogic.WLST osb.py -u osb_domain_utility.py -p osb_properties.py -d
Note for the -d option. this is the dry run.
Now you can navigate through you MBeans to check . When your done, execute the following statement:
- writeDomain('<your wls domain dir>')
Below some snippets of the code, if you want to obtain the code, please drop me an email.
With thanks to Fai Fung, who did the major part to create the basic framework of these scripts
IT Architect – Xebia
Publicatiedatum: 24 juni 2012