简体   繁体   English

jython 创建工作管理器,但我得到新属性未找到错误我该如何解决这个问题

[英]jython create work manager but I get the new attribute not found error how can i fix this

I was created array from text file in jython for use the wlst scripts.我是从 jython 中的文本文件创建的数组以使用 wlst 脚本。 But jython scripts finished with error.但是 jython 脚本以错误结束。 The error I get is as follows我得到的错误如下

import sys
import os
import jarray
import dircache
from java.io import File
from java.lang import String

myPropertyFile = "workManagerProperties.properties" 

def connection():
  print '===> Connecting as '+ username + ' To WebLogic URL ' + url + '...'
  try:
    connect(username, password, url)
  except WLSTException:
    print '==> Error Connecting to The URL ' + url
    CancelEdit('y')
    exit()

loadProperties(myPropertyFile)
url=protocol + '://' + host + ':' + AdminPort
connection()

def main():
edit()
startEdit()
cd ('/Clusters')
Clusters = cmo.getClusters()
for clusters in Clusters:
        svr = clusters.getName()
print svr 
input=open("/oracle12c/scripts/BS_WM_multiple.txt",'r')
m=input.readlines()
input.close()
z=[]
for v in m:
    z.append(v)
print z[0]

a=0
for i in z:    
    workManagerName=z[a] 
    print '======= Creating a WorkManager name as ======='
    cd('edit:/SelfTuning/' + domainName + '/WorkManagers/')
    create(workManagerName,'WorkManagers')
    cd('edit:/SelfTuning/' + domainName + '/WorkManagers/') 
    cd(workManagerName)
    ls('a')
    set('Targets',jarray.array([ObjectName('com.bea:Name='+svr+',Type=Cluster')], ObjectName))
    save()
    print ' WorkManager Created...'
    a=a+1
  save()
  activate(block="true")
main()
disconnect()

weblogic scripting tools jython scripts finished with error,The error I get is as follows.How can I fix this. weblogic scripting tools jython scripts finished with error,我得到的错误如下。我该如何解决这个问题。 This is the last point I come to.这是我要谈到的最后一点。 My already created attribute gives an error as not created.我已经创建的属性给出了未创建的错误。

======= Creating a WorkManager name as =======
MBean type WorkManager with name BPM_POST_AUTO_CHARGE_ORDER_INFO_BS_WM
has been created successfully.
BPM_POST_AUTO_CHARGE_ORDER_INFO_BS_WM

drw-   BPM_POST_AUTO_CHARGE_ORDER_INFO_BS_WM
Problem invoking WLST - Traceback (innermost last):
File "/oracle12c/scripts/wm_create/wm_test.py", line 52, in ?
File "/oracle12c/scripts/wm_create/wm_test.py", line 45, in main
File "<iostream>", line 165, in cd
File "<iostream>", line 553, in raiseWLSTException
WLSTException: Error occurred while performing cd : Attribute 
BPM_POST_AUTO_CHARGE_ORDER_INFO_BS_WM
not found. Use ls('a') to view the attributes

resolved as below解决如下

workManagerName= workManagerName.strip(' \t\n\r') workManagerName=workManagerName.strip('\t\n\r')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM