Justin's Blog

Pack/Unpack No More...

Justin Paul
Senior Principal Consultant
The online writeTemplate() command bug is resolved by the patch 22541322. Download the patch here: https://support.oracle.com/epmos/faces/PatchDetail?patchId=22541322.

If you have been building WebLogic domains, you know that after creating and configuring your domain on the Administration Server, you need to use the PACK command to create a managed server template. This template is then copied to all the managed server hosts and then the managed server domain is created using the UNPACK command.

If you wanted to automate your domain creation, you know that this is an additional step when you need to either place the template in a shared location between the admin server and managed servers or transfer the template using host commands like SCP. Would you want a command that would allow you to connect to the administration server from a managed server and download the domain somehow.

Starting with WebLogic 12c, you may be able to create a managed server domain on remote machines using online WLST.
The instructions are provided in the Oracle WebLogic documentation here:

Here is the snippet from the Oracle Documentation:

import os

wlsHome = os.getenv('WL_HOME')

mwHome = os.path.join(wlsHome, '..')

#Substitute the administrator user name and password values below as needed


#The path on the local machine where the template will be created,

#it should not already exist.

templatePath = 'user_templates/myTemplate.jar'

#get the packed template from the Administration Server


#disconnect from online WLST connection to the Administration Server


#select and load the template that was downloaded from the Administration




#specify the domain directory where the domain needs to be created

domainPath = 'domains/myRemoteDomain')

#create the domain


Join the discussion

Comments ( 7 )
  • guest Thursday, January 21, 2016

    This method of creating domain on managed server worked fine with 12.1.3 but failed to work with WebLogic 12.2.1.

    writeTemplate(templatePath)failed with error "Unable to download".

    Please let us know if it worked for you. Thanks.

  • guest Thursday, January 21, 2016

    No it did not and I have a bug opened (BUG# 22541428) for the issue.

    I will post an update once a fix is released.

  • Justin Paul Saturday, January 30, 2016

    The online writeTemplate() command bug is resolved by the patch 22541322.

    Download the patch here: https://support.oracle.com/epmos/faces/PatchDetail?patchId=22541322.

  • guest Tuesday, May 31, 2016

    This method has the same problem for me than using "pack.sh" with -managed=true.

    When I created the domain on first node, I set the "JavaHome" template option to a symlink (I have /opt/oracle/jdk which point to /opt/oracle/jdk1.8.0.91).

    In the domain on first node, all srcipts (setDomainEnv...) have JAVA_HOME=/opt/oracle/jdk, which is good if I want to change JDK version without reconfiguration.

    When I use that new method or pack with managed=true and I unpack on another node, I get JAVA_HOME=/opt/oracle/jdk1.8.0.91, and not the symlink.

    I have to use a normal pack/unpack without managed=true, so the JAVA_HOME is OK.

    But the bad point is that nodemanager.properties is not updated, and I have to replace liste address...

  • Justin Paul Tuesday, May 31, 2016

    Hi Adrien,

    Thanks for your update.

    This post is about connecting to an admin server and downloading the domain configuration as a template on a managed server. You then create the managed server domain using that. Since the admin server nodemanager may have been configured different, you have to set the listen addresses appropriately.

    You can look at some sample code I have written here: https://github.com/freneticdisc/oracle-fmw-tooling/blob/master/add_servers_onl.py

    connect('username', 'password', 't3://<serverhost>:7001')

    print "Writing domain to a template."

    domain_template = "/tmp/admindomain.jar"



    print "Loading the template."



    setOption("AppDir", os.path.join(domain_home, "applications"))

    setOption("OverwriteDomain", "true")

    print "Configuring Nodemanager."


    set("NodeManagerHome", os.path.join(domain_home, "nodemanager"))

    set("ListenAddress", host_name)

    set("ListenPort", nm_port)

    print "Writing Domain Configuration."




  • Adrien Tuesday, May 31, 2016

    Hmmm maybe I wasn't clear on my first comment.

    I used 4 methods to create a managed server on a second machine, and I had 2 different results :

    - pack on first machine without -managed=true and unpack on second machine with using -java_home=/opt/oracle/jdk


    - on first machine, readDomain, writeTemplate

    on second machine, readTemplate, setOption('JavaHome'), writeDomain

    -> It creates a domain, scripts set JAVA_HOME=/opt/oracle/jdk, BUT nodemanager host is host1 and not host2 (i think it's because it creates a new domain)

    - pack on first machine with -managed=true and unpack on second machine


    - from second machine, connect to admin, writeTemplate, readTemplate, writeDomain

    -> It creates a domain, scripts set wrong JAVA_HOME=/opt/oracle/jdk1.8.0.91, nodemanager host is host2

  • Adrien Tuesday, May 31, 2016

    I think I know how it works :

    - at product installation, weblogic follow symlinks, so in ORACLE_HOME, all files have JAVA_HOME=/opt/oracle/jdk1.8.0.91

    - at domain creation or unpacking (without -managed=true), you can force JAVA_HOME with template option, so it's OK

    - when you want to create a managed machine, with unpack or writeTemplate, you can't force JAVA_HOME, so it take the current JDK and follow symlink, so it's KO

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha