wlst embeded mode not working

srk picture srk · Sep 11, 2012 · Viewed 7.1k times · Source

I'm trying to build a small Utility for tasks like 1) connecting to weblogic admin server. 2) Add managed server. 3) Register domain with nodemanager, etcetera.

I started development in eclipse, added all the jars of weblogic\wlserver103\server\lib to my project buildpath.(I don't know which jars are required for wlst embeded mode) Development environment is set without any errors. When I'm trying to run the simple task like connecting to admin server. An exception was thrown as shown below

Connecting to t3://ksai.domain.simpledevelopers.com:7001 with userid javadev13 ...
The CompatabilityMBeanServer is not initialized properly. 
This might happen if the CompatabilityMBeanServer is 
disabled via the JMXMBean.

To view the root cause exception use dumpStack()

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.
Exception in thread "main" Traceback (innermost last):
File "<string>", line 1, in ?
File "<iostream>", line 22, in connect
File "<iostream>", line 618, in raiseWLSTException
WLSTException: Error occured while performing connect : "Cannot connect to WLST." 
Use dumpStack() to view the full stacktrace

I can do the same connect from wlst offline mode with the same username and password, which works well.As a workaround I've also tried giving userconfig and userKey secure files as parameters to connect command.

Note: Admin server is already started and running.

Answer

Mani picture Mani · Sep 12, 2012

Couple of things to try:

1 - Setting CompatibilityMBeanServerEnabled to true, perform these steps from command line wlst (replace username, password, hostname, adminport, DomainName with your settings)

connect('username','password','t3://hostname:adminport')
cd('JMX/DomainName')
ls()

now check the value of "CompatibilityMBeanServerEnabled" parameter, if its false then do the following

edit()
startEdit()
set('CompatibilityMBeanServerEnabled', 'true')
save()
activate()
shutdown()

startup the AdminServer now, and try invoking your WLST Embedded code

2 - If the above fix doesn't work then add "dumpStack()" in your WLST Embedded code to get the stack trace which will help in identifying the root cause.

3- To answer your question on which jar is required for WLST Embed mode , its weblogic.jar