我正在尝试执行 wlst 脚本来扩展托管服务器,但出现以下错误。由于我是 python 新手,无法弄清楚问题是什么,任何指针肯定会有所帮助,谢谢
Problem invoking WLST - Traceback (innermost last):
File "/MiddlewareOSB/MyOSB/common/bin/extendOSBDomain.py", line 214, in ?
File "MiddlewareOSB/MyOSB/common/bin/extendOSBDomain.py", line 27, in main
File "MiddlewareOSB/MyOSB/common/bin/extendOSBDomain.py", line 110, in createJMSResources
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
import sys
import os
def main():
try:
#load properties file
loadProperties('extend.properties')
print('connecting ' + adminUser + ' to Admin server')
connect(adminUser,adminPassword,'t3://'+adminHost+':'+adminPort)
exists = 1
index = 1
while exists == 1:
serverName = 'osb_server%s' % index
print "serverName is: " + serverName
try:
print('Check if server exists...')
cd('/Servers/'+serverName)
index += 1
except:
exists = 0
managedServerName = 'osb_server%s' % index
createManagedServer(managedServerName)
addNewMStoClusterList(managedServerName)
createJMSResources(managedServerName, index)
except:
traceback.format_exc()
exit()
def createManagedServer(managedServerName):
print ('*** Creating managed server ' + managedServerName + ' ...')
edit()
startEdit()
managedServer = create(managedServerName,'Server')
managedServer.setListenAddress(managedServerAddress)
managedServer.setListenPort(int(managedServerPort))
managedServer.setCluster(getMBean('/Clusters/' + clusterName))
# To add additional properties, such as SSL, web server information, Coherence specific startup parameters,
# server logging details or channels this would be the place to add it.
# For instance the following (once edited) adds SSL to the server
#
# server.setKeyStores('CustomIdentityAndCommandLineTrust')
# server.setCustomIdentityKeyStoreFileName(identityFileLocationAndPath)
# server.setCustomIdentityKeyStoreType('JKS')
# server.setCustomIdentityKeyStorePassPhrase(SSLPASSWORD)
#
# and this adds the coherence settings
#
# domainname=soaDomain+'_domain'
# domainlocation='/usr/appl/'+'%s'%tla+'/weblogic'
# cd('/Servers/' + managedServerName + '/ServerStart/' + managedServerName)
# cmo.setArguments('-DOSB.coherence.localhost=' + managedServerName + ' - DOSB.coherence.localport=7890 -DOSB.coherence.wka1=' + managedServerName + ' -DOSB.coherence.wka1.port=7890 -DOSB.coherence.wka2=' + managedServerName + ' -DOSB.coherence.wka1.port=7890 ')
activate()
print ('managed server created and added to the cluster')
def addNewMStoClusterList(managedServerName):
edit()
startEdit()
cd('/Clusters/' + clusterName)
activeCluster=cmo
try:
#increasing servers in list by 1
servers = activeCluster.getNumberOfServersInClusterAddress()
servers = servers + 1
#adding new server address and port
clusterList = activeCluster.getClusterAddress() + "," + managedServerAddress + ':' + managedServerPort
#if the cluster list not empty, add the new server to the list and increase number of servers in cluster list by 1
print ('*** Adding Server ' + managedServerName + ' to cluster address of cluster ' + clusterName + ' ...')
activeCluster.setNumberOfServersInClusterAddress(servers)
activeCluster.setClusterAddress(clusterList)
activate()
print ('cluster list updated')
except:
print('*** Cluster list failed to be updated - is the cluster address for the cluster empty?')
def createJMSResources(managedServerName, index):
edit()
startEdit()
targetServer = jarray.array([ObjectName('com.bea:Name='+ managedServerName +',Type=Server')], ObjectName)
# creating persistance stores for jms servers
# PLEASE NOTE - On some versions of OSB, you will need to create the physical folder for the filestore
print ('*** Creating FileStores')
filestore_list = ["FileStore", "WseeFileStore"]
count = 0
limit = 2
while count < limit:
filestore = filestore_list[count] + '_auto_%s' % index
print ('*** Adding ' + filestore )
cd('/')
cmo.createFileStore(filestore)
cd('/Deployments/' + filestore)
cmo.setDirectory(filestore)
set('Targets', targetServer)
print ('Filestore ' + filestore + ' created')
# create filestore directory, if it doesn't exist
dir = System.getenv('DOMAIN_HOME') + '/' + filestore
try:
os.stat(dir)
except:
os.mkdir(dir)
count += 1
print ('Filestores created')
# creating jms servers
print ('*** Creating JMS Servers')
# create wlsbJMSServer_auto_x jms server
cd('/')
cmo.createJMSServer('wlsbJMSServer_auto_%s' % index)
cd('/JMSServers/wlsbJMSServer_auto_%s' % index)
cmo.setPersistentStore(getMBean('/Deployments/FileStore_auto_%s' % index))
set('Targets', targetServer)
cd('/Deployments/wlsbJMSServer_auto_%s' % index)
cmo.setTemporaryTemplateResource('jmsResources')
cmo.setTemporaryTemplateName('TemporaryTmplt')
# create wseeJMSServer_auto_x jms server
cd('/')
cmo.createJMSServer('WseeJmsServer_auto_%s' % index)
cd('/JMSServers/WseeJmsServer_auto_%s' % index)
cmo.setPersistentStore(getMBean('/Deployments/WseeFileStore_auto_%s' % index))
set('Targets', targetServer)
targetWseeJmsServer = jarray.array([ObjectName('com.bea:Name=WseeJmsServer_auto_%s' % index + ',Type=JMSServer')], ObjectName)
targetWlsbJmsServer = jarray.array([ObjectName('com.bea:Name=wlsbJMSServer_auto_%s' % index + ',Type=JMSServer')], ObjectName)
print ('JMS Servers created')
# creating WseeJMSModule Components
print ('*** Create Queues: DefaultCallbackQueue-WseeJmsServer_auto_%s' % index + ' and DefaultQueue-WseeJmsServer_auto_%s' % index)
# create subdeployment within WseeJmsModule
cd('/JMSSystemResources/WseeJmsModule')
cmo.createSubDeployment('WseeJmsServer_auto_%s' % index + '-Sub')
# create DefaultQueue-WseeJmsServer_auto_x queue
cd('/JMSSystemResources/WseeJmsModule/JMSResource/WseeJmsModule')
cmo.createQueue('DefaultQueue-WseeJmsServer_auto_%s' % index)
cd('/JMSSystemResources/WseeJmsModule/JMSResource/WseeJmsModule/Queues/DefaultQueue-WseeJmsServer_auto_%s' % index)
cmo.setJNDIName('weblogic.wsee.DefaultQueue-WseeJmsServer_auto_%s' % index)
cmo.setSubDeploymentName('WseeJmsServer_auto_%s' % index + '-Sub')
cd('/JMSSystemResources/WseeJmsModule/SubDeployments/WseeJmsServer_auto_%s' % index + '-Sub')
set('Targets',targetWseeJmsServer)
# create DefaultCallbackQueue-WseeJmsServer_auto_x queue
cd('/JMSSystemResources/WseeJmsModule/JMSResource/WseeJmsModule')
cmo.createQueue('DefaultCallbackQueue-WseeJmsServer_auto_%s' % index)
cd('/JMSSystemResources/WseeJmsModule/JMSResource/WseeJmsModule/Queues/DefaultCallbackQueue-WseeJmsServer_auto_%s' % index)
cmo.setJNDIName('weblogic.wsee.DefaultCallbackQueue-WseeJmsServer_auto_%s' % index)
cmo.setSubDeploymentName('WseeJmsServer_auto_%s' % index + '-Sub')
cd('/JMSSystemResources/WseeJmsModule/SubDeployments/WseeJmsServer_auto_%s' % index + '-Sub')
set('Targets',targetWseeJmsServer)
print ('Queues within the WseeJMSModule created')
print ('*** Creating queues within the jmsResources module')
# create subdeployment within jmsResources
wlsJmsServerSubName = 'wlsbJMSServer%s' % index + '_sub'
cd('/JMSSystemResources/jmsResources')
cmo.createSubDeployment(wlsJmsServerSubName)
cd('SubDeployments/' + wlsJmsServerSubName)
set('Targets',targetWlsbJmsServer)
# create queues within jmsResources
queue_list = ["wli.reporting.jmsprovider.queue", "wli.reporting.jmsprovider_error.queue", "wlsb.internal.transport.task.queue.email", "wlsb.internal.transport.task.queue.file", "wlsb.internal.transport.task.queue.ftp", "wlsb.internal.transport.task.queue.sftp","QueueIn"]
count = 0
limit = 7
while count < limit:
queue = queue_list[count] + '_auto_%s' % index
dist_queue = 'dist_' + queue_list[count] + '_auto'
print ('*** Adding ' + queue + ' to ' + dist_queue)
cd('/JMSSystemResources/jmsResources/JMSResource/jmsResources/Queues')
cmo.createQueue(queue)
cd('/JMSSystemResources/jmsResources/JMSResource/jmsResources/Queues/' + queue)
cmo.setJNDIName(queue)
cmo.setSubDeploymentName(wlsJmsServerSubName)
cd('/JMSSystemResources/jmsResources/JMSResource/jmsResources/DistributedQueues/' + dist_queue)
cmo.createDistributedQueueMember(queue)
cd('/JMSSystemResources/jmsResources/JMSResource/jmsResources/DistributedQueues/' + dist_queue + '/DistributedQueueMembers/' + queue)
cmo.setWeight(1)
print ('Queue created and added to UDQ')
count += 1
# create SAF Agent
cd('/')
cmo.createSAFAgent('ReliableWseeSAFAgent_auto_%s' % index)
cd('/SAFAgents/ReliableWseeSAFAgent_auto_%s' % index)
cmo.setStore(getMBean('/FileStores/WseeFileStore_auto_%s' % index))
set('Targets',targetServer)
cmo.setServiceType('Both')
activate()
main()