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

Michel started his career as a medical officer in the Royal Dutch Airforce, with a focus on pharma. After the air force, he continued in pharma, followed by time working in clinical pharmacology. While there, he transitioned to IT by learning UNIX and MUMPS, and developed a system for managing patients’ medical records. As his career developed, his responsibility shifted from a deep technical perspective to a more visionary role. At the end of 2011, Michel authored a book on WebLogic Administration for beginners. He joined Qualogy in April 2012 where he expanded his repertoire significantly, serving a wide range of customers with his knowledge about Java Application Servers, Middleware and Application Integration. He also increased his multiple-industry knowledge in his role as Solutions or IT architect by working for customers in a range of sectors, including financials, telecom, public transportation and government organizations. In 2012, he received the IT Industry-recognized title of Oracle ACE for being an ambassador and community leader in his area of expertise. In 2019, this was enhanced to Oracle ACE Director. Michel is asked regularly to speak about technology and the impact of innovation at national and international conferences such as KubeCon, Oracle OpenWorld, Groundbreakers Developers Tours and others. He contributes actively to the OpenSource community and solutions regarding containerization, CI/CD and DevOps. In October 2021, Michel took an exciting step in his career by becoming Business Unit Manager for Qualogy Managed Services. While he still has a finger on the pulse in terms of technology, he is expanding his scope by combining his experience with the new insights gained in his new position. Read more via blog: https://bit.ly/3fAxrqf | Medium: https://mschildmeijer.medium.com/ | Books: Oracle Weblogic Server 11gR1 PS2: Administration Essentials: https://bit.ly/3IhALmf | Oracle WebLogic Server 12c: First Look1: https://bit.ly/31olbpj

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