我在Linux RHEL 7上运行wsadmin的Jython脚本这是它抛出错误的部分。
SCRIPT:
print "Setting WebContainer Properties....."
web=AdminConfig.list("WebContainer", srvr)
pyList = AdminConfig.list("Property", web)
if pyList:
for prop in pyList.split("\r\n"):
pname = AdminConfig.showAttribute(prop, "name")
if (pname == "MaxKeepAliveConnections" or pname == "MaxKeepAliveRequests"):
AdminConfig.remove(prop)
AdminConfig.save()
AdminConfig.create("Property", web, [["name", "MaxKeepAliveConnections"], ["value", 45]])
AdminConfig.create("Property", web, [["name", "MaxKeepAliveRequests"], ["value", 200]])
AdminConfig.save()
ERROR:
WASX7017E: Exception received while running file "createConfig.py"; exception information: com.ibm.ws.scripting.ScriptingException: WASX7025E: Error found in String "{_Websphere_Config_Data_Display_Name=MaxKeepAliveConnections(cells/vmisupcertsap3Cell01/nodes/vmisupcertsap3Node01/servers/server1|server.xml#Property_1453121436178)
MaxKeepAliveRequests, _Websphere_Config_Data_Id=cells/vmisupcertsap3Cell01/nodes/vmisupcertsap3Node01/servers/server1|server.xml#Property_1453196270515}"; cannot create ObjectName.
答案 0 :(得分:0)
targetServerName = sys.argv[0]
servers = AdminConfig.list("Server")
newline = java.lang.System.getProperty("line.seperator")
new_property_name1 = "MaxKeepAliveConnections"
new_property1 = '[[validationExpression ""] [name "MaxKeepAliveConnections"] [description "MaxKeepAliveConnections"] [value "45"] [required "false"]]'
new_property_name2 = "MaxKeepAliveRequests"
new_property2 = '[[validationExpression ""] [name "MaxKeepAliveRequests"] [description "MaxKeepAliveRequests"] [value "200"] [required "false"]]'
for serverID in servers.split(newline):
if serverID.find(targetServerName) == 0:
print serverID
webContainerID = AdminConfig.list("WebContainer", serverID)
print webContainerID
foundExisting = 0
webContainerPropList = AdminConfig.list("Property", webContainerID)
for webContainerProp in webContainerPropList.split(newline):
property_name = AdminConfig.showAttribute(webContainerProp, "name")
property_value = AdminConfig.showAttribute(webContainerProp, "value")
property_description = AdminConfig.showAttribute(webContainerProp, "description")
if property_name == new_property_name1 or property_name == new_property_name2:
print "Removing existing property " + webContainerProp
AdminConfig.remove(webContainerProp)
print "Creating property " + new_property_name1
AdminConfig.create("Property", webContainerID, new_property1)
print "Creating property " + new_property_name2
AdminConfig.create("Property", webContainerID, new_property2)
AdminConfig.save()