While creating a small startup script for nodemanager on my test setup (to prevent me from having to start nodemanager manually all the time) I figured storing the clear text password in the script was a bad practice. Therefore I wanted to use the storeUserConfig command in WLST to store the username and password in a user configuration file and an associated key file.
You would expect that to be not too exciting, but some caveats arose. First you have to connect nodemanager
wls:/offline> nmConnect('nodemanager','Welkom01','wls1.area51.local',5556,'hs_test'); Successfully Connected to Node Manager.
Then you can store the configuration:
wls:/nm/hs_test> storeUserConfig(userConfigFile='/u01/app/oracle/admin/nodemanager/nodemanager.config', userKeyFile='/u01/app/oracle/admin/nodemanager/nodemanager.keyfile'); Currently connected to Node Manager to monitor the domain hs_test. You will need to be connected to a running WLS or Node Manager to execute this command
mmmm… that was unexpected. Seems you have to pass an extra argument to mention that you are only connected to the nodemanager
storeUserConfig(userConfigFile='/u01/app/oracle/admin/nodemanager/nodemanager.config', userKeyFile='/u01/app/oracle/admin/nodemanager/nodemanager.keyfile',nm='true'); Currently connected to Node Manager to monitor the domain hs_test. Creating the key file can reduce the security of your system if it is not kept in a secured location after it is created. Do you want to create the key file? y or ny The username and password that were used for this WebLogic NodeManager connection are stored in /u01/app/oracle/admin/nodemanager/nodemanager.config and /u01/app/oracle/admin/nodemanager/nodemanager.keyfile .
Now that is all cool, next if you should be able to connect to nodemanager without specifying a username and password:
wls:/offline> nmConnect(userConfigFile='/u01/app/oracle/admin/nodemanager/nodemanager.config', userKeyFile='/u01/app/oracle/admin/nodemanager/nodemanager.keyfile', host='wls1.area51.local', port=5556, domainName='hs_test'); Connecting to Node Manager ... Traceback (innermost last): File "", line 1, in ? File "", line 123, in nmConnect File "", line 648, in raiseWLSTException WLSTException: Error occured while performing nmConnect : Cannot connect to Node Manager. : Access to domain 'hs_test' for user 'weblogic' denied Use dumpStack() to view the full stacktrace
Ehhrmm… that sort of sucks. Seems that the username is defaulted to weblogic all of the sudden. Well that sucks, that implies that you cannot use the stored configuration if your username is not weblogic (like in my case). Bummer… (I just hope I am wrong)
Hope this helps.
And thanks to Peter van Nes to learn me how to use the sourcecode setting in wordpress.