Creating a Weblogic domain template

To create a new Oracle WebLogic Server domain template you can use the Domain Template Builder. Follow these steps in order to launch it:

1.       From the terminal window, navigate to the location of the Domain Template Builder tool. It is found under <MIDDLEWARE_HOME>/wlserver/common/bin.

2.       Run the tool by entering the following command (config_builder.bat for Windows users):

$ ./config_builder.sh

The Domain Template wizard will start. In the “Create a New Template” window of the builder, select “Create a Domain Template as shown by the following snapshot:

 

oracle weblogic book oracle weblogic books

Click Next to continue. In the "Select a Template Domain Source" window, activate the “Select a Domain” upper tab.

oracle weblogic book oracle weblogic books

Then, navigate to the domain folder that you want to create a template from. In the above screenshot we are creating a template from the base_domain domain that we have formerly created.

Note: By choosing the Select aTemplate tab instead, you can create a template by extending an existing one template which needs to be selected from your file system as well.

Once selected the domain, click Next. In the following screen, select the name for the domain and optionally enter a description for it:

oracle weblogic book oracle weblogic books

Click Next. Now enter a name and a location for the template JAR file :

oracle weblogic book oracle weblogic books

In the next screen you can customize your template by adding files which will be included in the domain when you are creating it from this template:

oracle weblogic book oracle weblogic books

Click Next. In the next GUI you can optionally add SQL scripts which can be used to bootstrap your domain. 

oracle weblogic book oracle weblogic books

Click Next when done. In the following screen enter the template’s built-in server name, its listen address and the listen ports:

oracle weblogic book oracle weblogic books

Click Next and enter the administration user name and password.

oracle weblogic book oracle weblogic books

Click Next. In the following GUI you will be able to replace the standard scripts which are part of the template (e.g. start scripts) with your custom scripts.

oracle weblogic book oracle weblogic books

Click Next and review your template settings before storing it as a JAR file. As last step, check that your template has been actually written in the specified Template Location folder.

oracle weblogic book oracle weblogic books

Creating templates from the command line

Oracle WLS contains two utility scripts (named pack and unpack) which provide a simple one-step solution that can be used to create a template from the command line. These utilities are located in the MW_HOME/wlserver/common/bin folder of your distribution. Here’s how to use the pack shell to create a domain named mydomain into a file named mydomain.jar:

pack.sh -domain="/export/home/wlsuser/domains/mydomain" -template="/export/home/wlsuser/templates/mydomain.jar" -template_name="WLSDOMAIN" -log=/export/home/wlsuser/logs/wlscldompack.log -log_priority=INFO

The corresponding command used to expand your domain is unpack:

unpack.sh -template=mydomain.jar -domain=domains/mydomain -log=wlscldomunpack.log -log_priority=INFO
Francesco Google+