Jakarta ee WLST:不在编辑树中时无法调用编辑函数

Jakarta ee WLST:不在编辑树中时无法调用编辑函数,jakarta-ee,weblogic,weblogic12c,wlst,Jakarta Ee,Weblogic,Weblogic12c,Wlst,我正在尝试运行以下WLST脚本 import java.lang import os import string # 1 - Connecting to the Destination connect(username,password,server_url) edit() # 2 - Security Realm print "" print "================== Seucrity Realm ===================" startEdit() serve

我正在尝试运行以下WLST脚本

import java.lang
import os
import string

# 1 - Connecting to the Destination
connect(username,password,server_url)

edit()

# 2 - Security Realm
print ""
print "================== Seucrity Realm ==================="
startEdit()
serverConfig()

ap = cmo.getSecurityConfiguration().getDefaultRealm().lookupAuthenticationProvid
er('DefaultAuthenticator')

print "Create group " + user_group
ap.createGroup(user_group, user_group)

print "Craete user " + user_name
ap.createUser(user_name, user_pass, user_name)

print "Add user " + user_name + " to group " + user_group
ap.addMemberToGroup(user_group, user_name)

print "Create global role " + user_role

rm = cmo.getSecurityConfiguration().getDefaultRealm().lookupRoleMapper('XACMLRol
eMapper')
rm.createRole(None, user_role, None)
rm.setRoleExpression(None, user_role, 'Grp(' + user_group + ')')

# Save, activate and exit
# ==========================
print ""
save()
activate()
exit()
但是,我得到了错误

No stack trace available.
Problem invoking WLST - Traceback (innermost last):
  File "/u01/oracle/security-realm-config.py", line 40, in ?
  File "<iostream>", line 510, in save
  File "<iostream>", line 553, in raiseWLSTException
WLSTException: Error occurred while performing save : Cannot call Edit functions
 when you are not in the Edit tree.
没有可用的堆栈跟踪。
调用WLST-回溯(最里面的最后一个)时出现问题:
文件“/u01/oracle/security realm config.py”,第40行,在?
文件“”,第510行,保存
文件“”,第553行,在raiseWLSTException中
WLSTException:执行保存时出错:无法调用编辑函数
当您不在编辑树中时。
脚本仍然可以工作,但是为什么它会打印此错误,以及如何避免它?

问题在于“serverConfig()”行。从编辑上下文切换到“新”mbean树,该树不处于可编辑状态。将serverConfig()行移动到edit()命令之前,或者将其全部删除,因为无论如何连接后,serverConfig树都是默认树