2
votes

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.

3

3 Answers

1
votes

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

0
votes

Asumming that your WLS domain is located in /oracle/app/oracle/gc_inst/user_projects/domains/GCDomain, the following WLST commands worked for me on WLS10.3.6 and allow us to enable RuntimeMBeanServer:

1) Enable Platform MBean Server if disabled: 1.1. From WLS admin console, go to GCDomain > Configuration > General > Advanced 1.2. Select Platform MBean Server Enabled, save the changes and activate the changes. 1.3. Restart the admin server.

2) enable env variables for GCDomain

cd /oracle/app/oracle/gc_inst/user_projects/domains/GCDomain/bin
source setDomainEnv.sh

3) enable the RuntimeMBeanServerEnabled from WLST java weblogic.WLST

Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
wls:/offline> readDomain('/oracle/app/oracle/gc_inst/user_projects/domains/GCDomain')
wls:/offline/GCDomain>cd('JMX/NO_NAME_0')
wls:/offline/GCDomain/JMX/NO_NAME_0>set('PlatformMBeanServerUsed','true')
wls:/offline/GCDomain/JMX/NO_NAME_0>set('PlatformMBeanServerEnabled','true')
wls:/offline/GCDomain/JMX/NO_NAME_0>set('RuntimeMBeanServerEnabled', 'true')
wls:/offline/GCDomain/JMX/NO_NAME_0>updateDomain()
wls:/offline/GCDomain/JMX/NO_NAME_0>closeDomain()
wls:/offline>exit() 

Hope it works for you too.

0
votes

stopped node manager

killed the java process of server

than issued a

start.sh -c

to clear cached passwords and all the servers started.