How To configure SOA coherence clustering using WLST

When building a SOA cluster using WLST you still have to configure the Coherence clustering in the WebLogic startup parameters. I'll explain how this can be done using WLST in the following.

WebLogic has two methods of setting startup parameters. You can either change the scripts used for starting the server, or you can set them in a textfield in the server options.

We are going to do something similar to the latter method. But instead of using the WebLogic console, we will do this using WLST.

WLST can manipulate a domain either Offline or Online. Online means connecting to the AdminServer and running WLST against that. The other way is to read the Domain Configuration from the file system and manipulate it before writing it back to the file system. I will show you how to do both.

Online

To configure the coherence cluster using Online WLST you would do this:

connect(ADMIN_USER, ADMIN_PASS, ADMIN_ADDR)
edit()
startEdit()

#Build general arguments
arguments = []
arguments.append('-Dtangosol.coherence.wka1=<SOA HOST 1> -Dtangosol.coherence.wka1.port=9088 ')
arguments.append('-Dtangosol.coherence.wka2=<SOA HOST 2> -Dtangosol.coherence.wka2.port=9088 ')
general_arguments = ''.join(arguments)

#Build Local Arguments
local_arguments = general_arguments + '-Dtangosol.coherence.localhost=<SOA HOST 1> -Dtangosol.coherence.localport=9088
cd('Servers/<SOA SERVER 2>')
cmo.getServerStart().setArguments(local_arguments)
local_arguments = general_arguments + '-Dtangosol.coherence.localhost=<SOA HOST 2> -Dtangosol.coherence.localport=9088
cd('Servers/<SOA SERVER 2>')
cmo.getServerStart().setArguments(local_arguments)
save()

Offline

To configure the coherence cluster using Offline WLST a few modifications to the above needs to be done:

readDomain('<PATH TO DOMAIN>')

#Build general arguments
arguments = []
arguments.append('-Dtangosol.coherence.wka1=<SOA HOST 1> -Dtangosol.coherence.wka1.port=9088 ')
arguments.append('-Dtangosol.coherence.wka2=<SOA HOST 2> -Dtangosol.coherence.wka2.port=9088 ')
general_arguments = ''.join(arguments)

#Build Local Arguments
local_arguments = general_arguments + '-Dtangosol.coherence.localhost=<SOA HOST 1> -Dtangosol.coherence.localport=9088
cd('/Servers/<SOA SERVER 1>')
create('<SOA SERVER 1>', 'ServerStart')
cd('ServerStart/<SOA SERVER 1>')
set("Arguments", arguments)
local_arguments = general_arguments + '-Dtangosol.coherence.localhost=<SOA HOST 2> -Dtangosol.coherence.localport=9088
cd('/Servers/<SOA SERVER 1>')
create('<SOA SERVER 1>', 'ServerStart')
cd('ServerStart/<SOA SERVER 1>')
set("Arguments", arguments)
save()
setOption('OverwriteDomain', 'true')
writeDomain('<PATH TO DOMAIN>')
exit()

After everything is said and done you just have to restart the servers and the coherence cluster should be running in unicast clustering mode.

NB: The above code is untestet, but you should be able to get the general idea.