使用属性文件创建 JMS 队列

Create JMS Queue using properties file

我的 我正在使用此 python 脚本使用属性文件创建 JMS 队列,我的属性文件名为 domain.properties,错误为 WLSTException:执行连接时发生错误:ServerUrl

{from java.io import FileInputStream
import java.lang
import os
import string

propInputStream = FileInputStream('domain.properties')
configProps = Properties()
configProps.load(propInputStream)

ServerUrl = configProps.get('server.url')
Username = configProps.get('username')
Password = configProps.get('password')
jmsServerName = configProps.get('jms.server.name')
systemModuleName = configProps.get('system.module.name')
queueSubDeploymentName = configProps.get('queue.sub.deployment.name')
queueName = configProps.get('queue.name')
queueJNDIName = configProps.get('queue.jndi.name')


connect('Username','Password', 'ServerUrl')

edit()
print "================== Queue ==================="
startEdit()
cd('/')
cd('/JMSSystemResources/'+systemModuleName+'/JMSResource/'+systemModuleName)
cmo.createQueue(queueName)
print 'Created a Queue !!'
cd('/JMSSystemResources/'+systemModuleName+'/JMSResource/'+systemModuleName+'/Queues/'+queueName)
cmo.setJNDIName(queueJNDIName)
cmo.setSubDeploymentName(queueSubDeploymentName)
cd('/SystemResources/'+systemModuleName+'/SubDeployments/'+queueSubDeploymentName)
set('Targets',jarray.array([ObjectName('com.bea:Name='+jmsServerName+',Type=JMSServer')], ObjectName))
print 'Targeted the Queue to the created subdeployment !!'
activate()
print "success"

cmd = "rm -f wlst.log"
os.system(cmd)}

    **and finally i got the error
     WLSTException: Error occurred while performing connect: ServerUrl**

connect('Username','Password', 'ServerUrl')

这些参数是静态字符串,不是从属性文件中读取的变量。
您应该删除单引号。

connect(Username,Password, ServerUrl)