Bert Alfred
Bert Alfred

Reputation: 511

Error connecting to server via wlst

I have been developing a simple wlst script to test some basic admin features. My script runs perfectly fine from the wlst.sh but when I try to run it via an ant task I run into all sorts of problems. Below is my latest error:

[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.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [wlst] at java.lang.reflect.Method.invoke(Method.java:498) [wlst] at weblogic.management.scripting.utils.WLSTUtil.initOfflineContext(WLSTUtil.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(WLSTInterpreterInvoker.java:27) [wlst] Caused by: java.util.MissingResourceException: Can't find bundle for base name resources/config-wls/config, locale en_US [wlst] at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564) [wlst] at 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] at com.oracle.cie.common.util.ResourceBundleManager.manageBundle(ResourceBundleManager.java:94) [wlst] at com.oracle.cie.common.util.ResourceBundleManager.manageBundle(ResourceBundleManager.java:108) [wlst] at com.oracle.cie.domain.script.jython.WLScriptContext.init(WLScriptContext.java:221) [wlst] at com.oracle.cie.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 more [wlst] *** Trying to Connect.... ***** [wlst] Connecting to t3://myhost:7001 with userid weblogic ... [wlst] [wlst] The CompatabilityMBeanServer is not initialized properly. [wlst] This might happen if the CompatabilityMBeanServer is [wlst] disabled via the JMXMBean. [wlst] [wlst] To view the root cause exception use dumpStack() [wlst] [wlst] WLST detected that the RuntimeMBeanServer is not enabled. This [wlst] might happen if the RuntimeMBeanServer is disabled via the JMXMBean. [wlst] Please ensure that this MBeanServer is enabled. Online WLST cannot [wlst] function without this MBeanServer. [wlst] Traceback (innermost last): [wlst] File "./wl-test.py", line 8, in ? [wlst] File "", line 22, in connect [wlst] File "", line 648, in raiseWLSTException [wlst] WLSTException: Error occured while performing connect : "Cannot connect to WLST." [wlst] Use dumpStack() to view the full stacktrace

My build.xml has the following task definition:

<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" />

And this is my target:

  <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>

I have confirmed that CompatabilityMBeanServer is enabled on my server.

What is most confusing to me is that this works fine when I execute it via the wlst.sh script.

Upvotes: 0

Views: 902

Answers (1)

PavanDevarakonda
PavanDevarakonda

Reputation: 629

Of course this is lately answering, but this could help some beginners.

The better option for ant build script to have the taskdef, that include classpath.

  <taskdef classname="weblogic.ant.taskdefs.management.WLSTTask" name="wlst">
    <classpath>
      <pathelement location="${weblogic.lib.dir}/weblogic.jar">
    </pathelement></classpath>
  </taskdef>

please ref to my WLSTByExample blog link

Upvotes: 0

Related Questions