我一直在开发一个简单的wlst脚本来测试一些基本的管理功能 . 我的脚本从wlst.sh运行得很好但是当我尝试通过ant任务运行它时遇到了各种各样的问题 . 以下是我最新的错误:

[wlst] java.lang.reflect.InvocationTargetException [wlst] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[wlst] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[wlst] at sun . 在weblogic.management.scripting.utils.WLSTUtil.initOfflineContext(WLSTUtil . )的java.lang.reflect.Method.invoke(Method.java:498)[wlst]中反映.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[wlst] . java:291)[wlst] at weblogic.management.scripting.utils.WLSTUtil.setupOfflineInternal(WLSTUtil.java:267)[wlst] at weblogic.management.scripting.utils.WLSTUtil.setupOffline(WLSTUtil.java:234)[wlst ] at weblogic.management.scripting.utils.WLSTInterpreter . (WLSTInterpreter.java:134)[wlst] at weblogic.management.scripting.utils.WLSTInterpreter . (WLSTInterpreter.java:76)[wlst] at weblogic.management.scripting . WLSTInterpreterInvoker.executePyScript(WLSTInterpreterInvoker.java:57)[wlst] at weblogic.management.scripting.WLSTInterpreterInvoker.main(WLS TInterpreterInvoker.java:27)[wlst]引起:java.util.MissingResourceException:无法在java.util.ResourceBundle.throwMissingResourceException(ResourceBundle . )中找到基本名称资源/ config-wls / config,locale en_US [wlst]的包 . java:1564)[wlst] java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387)[wlst] at java.util.ResourceBundle.getBundle(ResourceBundle.java:1082)[wlst] at com.oracle.cie . common.util.ResourceBundleManager $ ResourceNamespace.manageBundle(ResourceBundleManager.java:341)[wlst]位于com.oracle.cie的com.oracle.cie.common.util.ResourceBundleManager.manageBundle(ResourceBundleManager.java:94)[wlst] . common.util.ResourceBundleManager.manageBundle(ResourceBundleManager.java:108)[wlst]位于com.oracle.cie的com.oracle.cie.domain.script.jython.WLScriptContext.init(WLScriptContext.java:221)[wlst] . domain.script.jython.WLScriptContext.setup(WLScriptContext.java:162)[wlst] at com.oracle.cie.domain.script.jython.WLST_offline.setupContext(WLST_offline.java: 105)[wlst] ... 11更多[wlst] ***尝试连接.... ***** [wlst]使用userid weblogic连接到t3:// myhost:7001 ... [wlst] [ wlst] CompatabilityMBeanServer未正确初始化 . [wlst]如果通过JMXMBean禁用CompatabilityMBeanServer [wlst],则可能会发生这种情况 . [wlst] [wlst]要查看根本原因异常,请使用dumpStack()[wlst] [wlst] WLST检测到未启用RuntimeMBeanServer . 如果通过JMXMBean禁用RuntimeMBeanServer,则可能发生此[wlst] . [wlst]请确保已启用此MBeanServer . 没有这个MBeanServer,在线WLST不能[wlst]运行 . [wlst] Traceback(最里面的最后一个):[wlst]文件“./wl-test.py”,第8行,在? [wlst]文件“”,第22行,在connect [wlst]文件“”,第648行,在raiseWLSTException [wlst] WLSTException:执行连接时出错:“无法连接到WLST . ” [wlst]使用dumpStack()查看完整的堆栈跟踪

我的build.xml具有以下任务定义:

<path id="wl.classpath">
        <fileset dir="/Users/me/Oracle/Middleware/wlserver_10.3/server/lib">
              <include name="*.jar"/>
        </fileset>
        <fileset dir="/Users/me/Oracle/Middleware/oracle_common/modules">
              <include name="*.jar"/>
        </fileset>
</path>
  <taskdef name="wlst" classpathref="wl.classpath" classname="weblogic.ant.taskdefs.management.WLSTTask" />

这是我的目标:

<target name="wlstTest">
   <wlst debug="false" failOnError="false" executeScriptBeforeFile="true"
    fileName="./wl-test.py">
    <script>
      print("*** Trying to Connect.... *****")
      connect('weblogic','weblogic','t3://myhost:7001')
      print("*** Connected *****")
    </script>
   </wlst>
</target>

我已确认在我的服务器上启用了CompatabilityMBeanServer .

最令我困惑的是,当我通过wlst.sh脚本执行它时,这很好用 .