我正在用Python / WLST编写代码以自动化连接,启动和停止Weblogic中的托管服务器。启动python时出现以下错误。我问您异常的含义以及如何解决。任何帮助都感激不尽!
这里是错误:
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
172.31.138.15:7001
Connecting to t3://172.31.138.15:7001
with userid weblogic ...
WLST detected that the RuntimeMBeanServer is not enabled. This
might happen if the RuntimeMBeanServer is disabled via the JMXMBean.
Please ensure that this MBeanServer is enabled. Online WLST cannot
function without this MBeanServer.
This Exception occurred at Mon Jan 13 08:52:50 CET 2020.
java.lang.NumberFormatException: For input string: "7001
"
The domain is unreacheable
代码是:
-bash
#! /bin/sh
echo $(find /u01/ -name config.xml |grep -v bak| xargs grep -A4 AdminServer | grep listen-address | cut -d'>' -f 2 | cut -d'<' -f 1)
-Python / WLST
import sys
import os
from java.lang import System
import getopt
import time
values = os.popen(str('sh /home/oracle/scripts/wls/adminurl.sh'))
url = str("".join(map(str, values)))
port = ":7001"
adminurl = url.rstrip() + port + "\n"
def connectToDomain():
try:
if ServerName != "" or username == "" and password == "" and adminUrl == "":
print (adminurl)
connect(userConfigFile='/home/oracle/scripts/wls/userconfig.secure', userKeyFile='/home/oracle/scripts/wls/userkey.secure', url=adminurl, timeout=60000)
[...]
此外,在Adminserver控制台中启用了RuntimeMBeanServer
有什么想法吗?谢谢。
可能由adminurl = url.rstrip() + port + "\n"
引起。不带\ n