我试着在WLST试图让一个集群的名称WLST
cd("/JDBCSystemResources/<datasource name>")
targets = get('Targets')
mytarget = targets[0]
这工作得很好,以获得数据源的第一个簇的字符串值名称。如果我使用viewMBean命令“viewMBean(mytarget)”,我可以看到Name为属性“Name”
如果我打印mytarget的值,我会得到类似于:“com.bea:Name = Cluster-1,Type =集群”
但我不能工作,如何获取名称(‘集群1’在上面的例子)
目前,我想不出什么做除了让群集名称作为对象的字符串表示的子串,这听起来不像是要做的事情
任何帮助表示赞赏。
更新:
由于没有答案为止我使用这个解决方案,但仍然希望一个更好的
# get the target cluster from the string "com.bea:Name=<clustername>,Type=Cluster"
if len(targets) == 1 :
tstring = str(targets[0])
targetCluster = tstring[13:tstring.find(",Type=Cluster")]
print "targetCluster = "+targetCluster;
else :
raise Exception("Expected single target cluster for datasource. Targets length was "+str(len(targets)))
比从未更好的迟到;-) – Dunderklumpen