This discussion is archived
1 Reply Latest reply: Feb 26, 2013 10:02 AM by 828189 RSS

WLST Offline mode Creating Work Managers and assigning multiple targets

956510 Newbie
Currently Being Moderated
Can anyone please tell me how to assign multiple servers to a workmanager using WLST in offline mode.

I want to create a domain from wls.jar and add a number of managed servers assigned to a machine and work manager

I have created the managed servers, machine and work manager using

print 'CREATE MANAGED SERVERS';
cd('/')
create('ServerA', 'Server')
cd('Servers/ServerA')
set('ListenAddress','localhost')
set('ListenPort',7101)
cd('/')
create('ServerB', 'Server')
cd('Servers/ServerB')
set('ListenAddress','localhost')
set('ListenPort',7102)

print 'CREATE MACHINE'
cd('/')
create('MyMachine', 'Machine')
cd('/Machine/MyMachine')
create('MyMachine', 'NodeManager')
cd('NodeManager/MyMachine')
set('ListenAddress','localhost')
set('ListenPort',5557)
set('NMType', 'ssl')

print 'ASSIGN SERVERS TO MACHINE'
assign('Server', 'ServerA','Machine', 'MyMachine')
assign('Server', 'ServerB','Machine', 'MyMachine')

print 'CREATE WORK MANAGER';
cd('/')
create('basicWLSDomain', 'SelfTuning')
cd('/SelfTuning/' + 'basicWLSDomain')
create('MyWorkManager', 'WorkManager')
cd('/SelfTuning/basicWLSDomain/WorkManager/MyWorkManager')

I can set one Server as a target using

print 'ASSIGN SERVERS TO WORK MANAGER'
set('Target', 'ServerA')

but if I then add
set('Target', 'ServerB') this overwrites rather than adds ServerA

assign work ok for machine (see above)
but I can't work out what the syntax for assign is for the workmanager (or if it works at all)
assign('WorkManger' .... is not recognised

any help appreciated
  • 1. Re: WLST Offline mode Creating Work Managers and assigning multiple targets
    828189 Newbie
    Currently Being Moderated
    This is due to you assigning only 1 target. I suggest using something like the following:

    refBean0 = getMBean("/Clusters/bam_cluster")
    refBean1 = getMBean("/Clusters/soa_cluster")
    refBean2 = getMBean("/Clusters/osb_cluster")
    refBean3 = getMBean("/Servers/AdminServer")
    theValue = jarray.array([refBean0,refBean1,refBean2,refBean3], Class.forName("weblogic.management.configuration.TargetMBean"))
    cmo.setTargets(theValue)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points