Simple WLST script to add WebLogic Cluster timer scheduler

Michel Schildmeijer

It seems like an easy task to do within WebLogic Admin Console, but sometimes an administrator requires automation. WebLogic Server can schedule future tasks similar to a scheduled job. It works by using the class that will execute the task and metadata to a database.  One cluster member will be responsible for JobScheduler which invokes the Timertask.  The server responsible for this service will check the database every xx secs to see if there are new tasks .

To setup the Timer you will need a datasource and table name for the timer ( default name WebLogic uses is weblogic_timers) That section is not covered inhere, but just a simple script to set up the timer

## Created by M. Schildmeijer
## WLST Script to configure the WebLogic Scheduler Table name and DataSource
## Replace anything between <> with your own WebLogic Server values
## Properties Section
user='weblogic'
pw='<password weblogic admin>'
adminServer='<AdminServer Host>'
adminPort='<Admin Port>'
clusterName='<cluster name>'
jsschedtblnm='<job scheduler table name>'
dsname='<DataSource Name>'
## Standard Connection creation
try:
  connect(user,pw,'t3://'+adminServer+':'+adminPort)
except:
  print 'Error connecting to Admin Server'
## Get the list of managed servers in the cluster
try:
  domainConfig()
  cd('Clusters/'+clusterName)
  managedServers=cmo.getServers()
  print 'Found ' + ' managed servers' + managedServers
except:
  print 'Error navigating DomainConfig MBean tree for the list of managed servers'
  ## Start an edit session and navigate
domainConfig()
edit()
startEdit()
cd('/Clusters/' +clusterName)
cmo.setJobSchedulerTableName(jsschedtblnm)
save()
cd('/Clusters/' +clusterName +'/' +'setDataSourceForJobScheduler' )
cmo.setDataSourceForJobScheduler(dsname)
save()
activate() 
Next Post

Masterclass Advanced SQL - entertaining and intensive

Facebook0TwitterLinkedinYesterday I presented the Masterclass Advanced SQL to an audience of very experienced Oracle Database developers – one veteran had started his career on Oracle 5 in the late 1980’s. In a long, intensive day – 9 – 5 and beyond – we discussed many real life experiences, many practical […]