Creating an OSB domain using WLST

One of the main use cases of WLST is to automate the creation of your domains. Using WLST you can add all the configuration you need for your domain and ensure that it will be created exactly the same each time you build it (as opposed to relying on your infrastructure team member to remember to configure everything through the weblogic console). Also, you can add your WLST script into your version control repository to ensure that all changes are tracked and that everyone can always have the most up-to-date configuration.

To give you an idea of how to create a domain in WLST let’s create a simple OSB domain. We’ve created a script ‘’ that will create the domain and configure the JDBC data sources (among other things). This will create a fully working OSB domain for us to work with. In our next post we will create a WLST script to start up this domain, but for the time being we can start it the old fashioned way (./

The full code is up at GitHub:

The contents of this post will be discussed at the upcoming Oracle Middleware Forum in Canberra. Why not come along and pick up some more WLST tips?

Step by step

First we use templates to add the basic configuration for our domain. We could do this from scratch, but why re-invent the wheel?

readTemplate(WL_HOME + '/common/templates/domains/wls.jar')

addTemplate(OSB_HOME + '/common/templates/applications/wlsb.jar')
addTemplate(OSB_HOME + '/common/templates/applications/wlsb_owsm.jar')
addTemplate(MW_HOME + '/oracle_common/common/templates/applications/oracle.em_11_1_1_0_0_template.jar')

Here we load the basic wls.jar template and configure our weblogic user. Then write the domain to the filesystem and then add the extra templates we need to support OSB:

  • wlsb.jar: Configures the domain for OSB, includes the sbconsole deployment and an osb_server1 server by default
  • wlsb_owsm.jar: Adds support for Oracle Web Services Manager (OWSM)
  • oracle.em_11_1_1_0_0_template.jar: Adds Enterprise Manager to the domain

The next step is to configure the MDS and OWSM JDBC data sources. You should have already created these schemas in your Oracle database using RCU. The script is pretty self-explanatory here, it just goes through all the necessary steps to configure a JDBC data source.

create('wlsbjmsrpDataSource', 'JDBCSystemResource')

Then we configure the machines on the domain so they have the correct listen ports. You can use the defaults, but it’s always good to configure these in your scripts in case you need to change ports later (or host two domains on the one machine for instance)

cd ('/')

cd('/Server/' + ADMIN_SERVER)

cd('/Server/' + MANAGED_SERVER)

cd ('/SecurityConfiguration/' + DOMAIN)

And then we create some machines and associate the Admin and OSB servers with them.

print('Creating machines')
cd ('/')
create(MACHINE, 'UnixMachine')
cd('/Machines/' + MACHINE)
create(MACHINE, 'NodeManager')
cd('NodeManager/' + MACHINE)
set('NMType', 'Plain')
set('ListenPort', NODE_MANAGER_PORT)

cd('/Server/' + ADMIN_SERVER)

cd('/Server/' + MANAGED_SERVER)

Finally we apply all our changes to the domain through the updateDomain() function. We run the script with:

java weblogic.WLST


The script is pretty to easy to use, but here’s some problems you might encounter:

  • Make sure you’ve installed OSB into your weblogic folder otherwise the templates won’t be available!
  • Before running your script you will need to set your domain environment variables. Use the ./ file in the WL_HOME/common/bin folder
  • You can run this script as an executable without the need to call java before hand by adding the following to the first line of the script. This will set the environment variables for you and allow you to call the script as ./ (Note: your path to may be different)
    • #!/usr/bin/env /oracle/product/middleware/Oracle_OSB1/common/bin/

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s