Ошибка компонента WLST при попытке установить целевой сервер - PullRequest
0 голосов
/ 04 февраля 2019

Я пытаюсь создать менеджер работ, запустив мой код на Python с использованием WLST.В моем коде Python при попытке установить целевой сервер для менеджера работы с cmo.addTarget (bean) , он выдает следующую ошибку:

======= Создание имени WorkManager для WM_AgreementOps11 =======

MBMan-тип WorkManager с именем WM_AgreementOps11 успешно создан.

Нет трассировки стека.Это исключение произошло в понедельник, 04 февраля 13:13:51 IST 2019. javax.management.AttributeNotFoundException: com.bea: Name = WM_AgreementOps11, SelfTuning = DefaultDomain, Type = WorkManager: SelfTuning Traceback (последний вызов был последним): файл "C:\ Oracle \ Middleware \ Oracle_Home \ wlserver \ server \ bin \ WorkManagerSetUp.py ", строка 70, в основном cmo.addTarget (bean) java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: ожидается ненулевое значение

Сохранение всех ваших изменений ... Все изменения были успешно сохранены.WorkManager Создан ...

Ниже приведен код:

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

#=======================================================================================    
myPropertyFile = "workManagerProperties.properties" 

print '======= Reading Property File and Connecting to Server ========'
propInputStream = FileInputStream(myPropertyFile)
configProps = Properties()
configProps.load(propInputStream)

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

print '==== Exiting Because Of Connectivity Error ===='

#===== THE SERVER URL ==================================================================
url=configProps.get("protocol") + '://' + configProps.get("host") + ':' + configProps.get("AdminPort")
connection()
#=======================================================================================
wmcount=configProps.get("workManager.count")

print '======= Number of Work Managers to be set: ' + wmcount + ' ======='

#=======================================================================================
# START EDITING WORK MANAGER
#=======================================================================================

def main():

    print ('================== inside main ==================') 
    DSCOUNT=1
#=======================================================================================    
    while(DSCOUNT<=int(wmcount)):
        edit()
        startEdit()
        ServerName=configProps.get("ServerName")
        domainName=configProps.get("domainName")
        workManagerName=configProps.get("workManagerName."+str(DSCOUNT))    
        MaxThread=configProps.get("MaxThread."+str(DSCOUNT))
        MinThread=configProps.get("MinThread."+str(DSCOUNT))    
        maxThreadConstraintName=configProps.get("maxThreadConstraintName."+str(DSCOUNT))    
        minThreadConstraintName=configProps.get("minThreadConstraintName."+str(DSCOUNT))    
#==================================== WORK MANAGER ========================================
        print '======= Target Server for Work Managers: ' + ServerName + ' ======='    
        print '======= Creating a WorkManager name for ' + workManagerName + ' ======='   
        cd('edit:/SelfTuning/' + domainName + '/WorkManagers/')
        try:
            create(workManagerName,'WorkManagers')
        except:
            traceback.print_exc()
        cd('edit:/SelfTuning/' + domainName + '/WorkManagers/' + workManagerName)
        bean = getMBean("/Servers/"+ ServerName)
        try:
            cmo.addTarget(bean)
        except:
            traceback.print_exc()
        save()
        print ' WorkManager Created...'

        print '======= Creating MaxThreadsConstraint ======='
        cd('edit:/SelfTuning/' + domainName + '/MaxThreadsConstraints/')
        try:
            create(maxThreadConstraintName,'MaxThreadsConstraints')
        except Exception:
            print 'Issue in Creating MaxThreads exiting'
        cd('edit:/SelfTuning/' + domainName + '/MaxThreadsConstraints/' + maxThreadConstraintName)
        bean = getMBean("/Servers/"+ ServerName)
        try:
            cmo.addTarget(bean)
        except:
            traceback.print_exc()
        set('Count',MaxThread)
        save()
        print ' MaxThreadsConstraints Created...'

        print '======= Creating MinThreadsConstraint ======='
        cd('edit:/SelfTuning/' + domainName + '/MinThreadsConstraints/')
        try:
            create(minThreadConstraintName,'MinThreadsConstraints')
        except Exception:
            print 'Issue In Creating MinThreads '
        cd('edit:/SelfTuning/' + domainName + '/MinThreadsConstraints/' + minThreadConstraintName)
        bean = getMBean("/Servers/"+ ServerName)
        try:
            cmo.addTarget(bean)
        except:
            traceback.print_exc()
        set('Count',MinThread)
        save()
        print ' MinThreadsConstraints Created...'

        print '======= Assigning the MaxThreadConstraint to the WorkManager ======='
        cd('edit:/SelfTuning/' + domainName + '/WorkManagers/' + workManagerName)
        bean=getMBean('/SelfTuning/' + domainName + '/MaxThreadsConstraints/' + maxThreadConstraintName)
        cmo.setMaxThreadsConstraint(bean)

        print '======= Assigning the MinThreadConstraint to the WorkManager ======='
        cd('edit:/SelfTuning/' + domainName + '/WorkManagers/' + workManagerName)
        bean=getMBean('/SelfTuning/' + domainName + '/MinThreadsConstraints/' + minThreadConstraintName)
        cmo.setMinThreadsConstraint(bean)

        save()
        activate(block="true")
        print '==> WorkManager Creation Finished ... Please Double Check from AdminConsole...'
        DSCOUNT=DSCOUNT+1
    disconnect()

main()
...