1

I have a Jython script calling wsadmin libraries to configure a WAS server.

I have these functions:

def createWasObject(was_object_type, was_path, object_params):
  if isinstance(was_path, basestring):
    was_path = AdminConfig.getid(was_path)
  str_params = '['
  for k,v in object_params.items():
    str_params = str_params + '[' + k + ' "' + v + '"] '
  str_params = str_params + ']'
  return AdminConfig.create(was_object_type, was_path, str_params)

def createJdbcProviders(was_path, jdbc_providers):
  was_object_type = 'JDBCProvider'
  for jdbc_provider in jdbc_providers:
    jdbc = createWasObject(was_object_type, was_path,     jdbc_provider['params'])
    print jdbc

    for datasource in jdbc_provider['datasources']:
      ds = createWasObject('Datasource', jdbc, datasource['params'])
  print

The "print jdbc" prints:

Teradata JDBC Provider(cells/jsr-websphere-1Cell01/nodes/jsr-websphere-1Node01/servers/jsr-business|resources.xml#JDBCProvider_1444648929602)"

Which looks like a correct object ID

However, when using it to create a datasource, I get the following error:

WASX7017E: Exception reçue lors de l'exécution du fichier "/root/jsr_auto_deployment/jsr.py" ; informations sur l'exception : com.ibm.ws.scripting.ScriptingException: Invalid object name: "Teradata JDBC Provider(cells/jsr-websphere-1Cell01/nodes/jsr-websphere-1Node01/servers/jsr-business|resources.xml#JDBCProvider_1444648929602)"

I am using Jython 2.7 through a Thin client. Reusing an object returned by AdminConfig.create() was working well with a Jython script ran through wsadmin.sh

1 Answers1

0

My problem was on that line: was_path = AdminConfig.getid(was_path)

Most of the time I was passing a string but this time I was already using an ID. So I removed the AdminConfig.getid in the function and added it in the calls when necessary only.