WLST domain creation using dry-run

WLST domain creation using dry-run

Published on: 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)

  1. 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:

  1. writeDomain('<your wls domain dir>')
  2.  

Below some snippets of the code, if you want to obtain the code, please drop me an email.

user profile

osb_properties.py:

osb_domain_utility

osb.py

With thanks to Fai Fung, who did the major part to create the basic framework of these scripts 

Reference:

Fai Fung

IT Architect – Xebia

http://www.xebia.com

Publicatiedatum: 24 juni 2012

Michel Schildmeijer
About the author Michel Schildmeijer

Having made his start in the pharmacy sector, Michel transitioned to IT in 1996, working on a UNIX TTY terminal-based system and the MUMPS language. He currently works as a solutions architect at Qualogy, with a focus on middleware, application integration and service-oriented architecture. His passion for middleware started in 2000 when working as a support analyst for a financial institute with BEA WebLogic and Tuxedo. Michel is an expert on the WebLogic platform. He serves customers in his role as architect and advises them in all aspects of their IT landscape. He became an Oracle ACE in 2012 and wrote two books about WebLogic: Oracle WebLogic Server 11gR1 PS2: Administration Essentials and Oracle WebLogic Server 12c: First Look. He is a well-known speaker at national and international conferences and is recognised as an official Oracle Speaker. Read his blog: https://community.oracle.com/blogs/mnemonic

More posts by Michel Schildmeijer
Comments (1)
  1. om 09:09

    Nice post. I need this scripts. Can I have these?

    My email id: sreeni5877@gmail.com

Reply