2017-05-31 87 views
0

當我嘗試執行我Jython腳本我得到這個錯誤:WASX7017E:Jython的例外文件 「<string>」

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原泊塢窗圖像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

就發現,雙引號的參數做這項工作:

createJ2CAuthAlias("dbuser","description","DBUSER","PASS")