当我尝试执行我的Jython
脚本时,我收到此错误:
WASX7017E: Exception received while running file "/opt/test_wsadmin_configura_datasource.jython"; exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
File "<string>", line 29, in ?
NameError: dbuser
这是我的test_wsadmin_configura_datasource.jython
##
# src: https://www.ibm.com/developerworks/community/blogs/timdp/entry/automating_application_installation_and_configuration_into_websphere_application_server46?lang=en
#
# eseguire con wsadmin.sh -lang jython
# get an environment variable
import os;
#installRoot = os.environ["INSTALL_ROOT"]
# useful variables
cell = AdminControl.getCell()
node = AdminControl.getNode()
server = AdminControl.getConfigId(AdminControl.queryNames("node="+node+",type=Server,*"))
varmap = AdminConfig.list('VariableMap', server)
appman = AdminControl.queryNames("type=ApplicationManager,*")
def createJ2CAuthAlias(alias,description,user,password):
sec = AdminConfig.getid('/Cell:'+ cell +'/Security:/')
alias_attr = ["alias", alias]
desc_attr = ["description", description]
userid_attr = ["userId", user]
password_attr = ["password", password]
attrs = [alias_attr, desc_attr, userid_attr, password_attr]
authdata = AdminConfig.create('JAASAuthData', sec, attrs)
print "J2C Auth Alias created ---> " + alias
AdminConfig.save()
return
createJ2CAuthAlias(dbuser,description,DBUSER,PASS)
WebSphere正在原始docker image ibmcom/websphere-traditional:8.5.5.11-install
我该如何解决?
EDIT1: Here发现此问题可能与非UTF8字符有关。
These errors can occur because there are UTF-8 characters in the file that are not valid. ... An easy way to determine if a character that is not valid is causing the error is to enter export LANG=C and run the script again.
export LANG=C
不会更改结果。
答案 0 :(得分:0)
刚发现双引号参数完成了这项工作:
createJ2CAuthAlias("dbuser","description","DBUSER","PASS")