Friday, 14 July 2017

TypeError: __add__ nor __radd__ defined for these operands

Whilst scripting the configuration of the WebSphere Application Server transaction/compensation/partner logs into an Oracle database: -

/opt/ibm/WebSphereProfiles/Dmgr01/bin/wsadmin.sh -lang jython -user wasadmin -password passw0rd -f tranlogs.jy 

I saw this: -

WASX7209I: Connected to process "dmgr" on node Dmgr using SOAP connector;  The type of process is: DeploymentManager
WASX7017E: Exception received while running file "tranlogs.jy"; exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
  File "<string>", line 18, in ?
TypeError: __add__ nor __radd__ defined for these operands


Last time I saw this error ( 2012 ), it was user error.

I checked my script ( specifically line 18 as per the exception ) : -

datasource=AdminTask.createDatasource(provider, '[-name '+clusterName+'_Tranlogs -jndiName jdbc/'+clusterName+'_Tranlogs -dataStoreHelperClassName com.ibm.websphere.rsadapter.Oracle11gDataStoreHelper -containerManagedPersistence true -componentManagedAuthenticationAlias '+j2cAlias+' -configureResourceProperties [[URL java.lang.String jdbc:oracle:thin:@//'+dbHost+':'+dbPort+'/'+dbName+']]]')

Looking at the concatenation of three strings ( dbHost, dbPort and dbName ) gave me a clue, and I checked the variables, and found: -

dbPort=1521

In other words, I'd defined it as an integer whereas Jython was expected a string.

Once I changed it: -

dbPort='1521'

the script ran without errors.

No comments: