WSadmin TypeError:使用AdminConfig.modify,序列下标必须是整数或切片

时间:2014-10-10 14:36:43

标签: python websphere jython wsadmin ibm-was

我正在尝试在Jython中创建一个脚本,将一些应用程序从7迁移到8.5。创建数据源后,我遇到此错误约2小时: TypeError:序列下标必须为整数或切片

问题出现在第25行,我不知道如何解决它。如果您需要更多信息,请告诉我。 请帮我!非常感谢你!

我的代码:

if ( len(OracleDataSourceList) > 0 ):
dbuserList=AdminTask.listAuthDataEntries()
for dataSource in OracleDataSourceList:
    datasourceName=dataSource[0]
    dsJNDIName=dataSource[1]
    compAuthAlias=dataSource[2]
    providerName=dataSource[3]
    dataStoreHelperClassName=dataSource[4]
    description=dataSource[5]
    databaseURL=dataSource[6]
    databaseMaxConnections=dataSource[7]
    databaseMinConnections=dataSource[8]
    databaseconnTimeout=dataSource[9]
    databasereapTime=dataSource[10]
    databaseunusedTimeout=dataSource[11]
    databaseagedTimeout=dataSource[12]

    #Create Data Source
    dataSourceId = AdminJDBC.createDataSourceAtScope( scope, providerName, datasourceName, dsJNDIName, dataStoreHelperClassName, databaseURL, [['componentManagedAuthenticationAlias',compAuthAlias],['containerManagedPersistence','true'],['description',description]])

    #Modify connection pool
    connectionPoolList = AdminConfig.list('ConnectionPool', dataSourceId)
    connectionPoolList = AdminUtilities.convertToList(connectionPoolList)
    connectionPoolId = connectionPoolList[0]
    AdminConfig.modify(connectionPoolId, [["maxConnections", databaseMaxConnections]\
                                          ["minConnections", databaseMinConnections]\
                                          ["connTimeout", databaseconnTimeout]\
                                          ["reapTime", databasereapTime]\
                                          ["unusedTimeout", databaseunusedTimeout]\
                                          ["agedTimeout", databaseagedTimeout]\
                                         ])
print 'Saving configuration...'
AdminConfig.save()
print "Configuration saved."

错误:

WASX7017E: Exception received while running file "createDataSource.py"; exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
   File "<string>", line 25, in ?
TypeError: sequence subscript must be integer or slice

1 个答案:

答案 0 :(得分:0)

我解决了这个问题。

将第25:31行替换为:

AdminConfig.modify(connectionPoolId, [["maxConnections", databaseMaxConnections], ["minConnections", databaseMinConnections], ["connectionTimeout", databaseconnTimeout], ["reapTime", databasereapTime], ["unusedTimeout", databaseunusedTimeout], ["agedTimeout", databaseagedTimeout]])