2012-09-11 39 views
2

我试图建立一个小的工具,如 1)连接到weblogic管理服务器。 2)添加托管服务器。 3)用nodemanager等注册域名。我开始在Eclipse中进行开发,将所有weblogic \ wlserver103 \ server \ lib的jar文件添加到我的项目构建路径中(我不知道wlst嵌入模式需要哪些jar)开发环境设置没有任何错误。当我试图运行像连接到管理服务器这样的简单任务时。一个异常被抛出如下图所示wlst嵌入模式不起作用

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 

我可以做同样的从WLST脱机模式下使用相同的用户名和密码,其中工程well.As一种变通方法我也试过给UserConfig的和USERKEY安全文件作为连接连接命令的参数。

注意:管理服务器已经启动并正在运行。

回答

1

几件事情尝试:

1 - 设置CompatibilityMBeanServerEnabled为真,执行命令行WLST这些步骤(更换用户名,密码,主机名,后台入口,域名与您的设置)

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

现在检查“CompatibilityMBeanServerEnabled”参数的值,如果其为false,则执行以下操作

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

现在启动AdminServer,并尝试调用您的WLST嵌入代码

2 - 如果上述修复程序不起作用,请在您的WLST嵌入代码中添加“dumpStack()”以获取堆栈跟踪,这将有助于确定根本原因。

3〜回答你的问题上这是需要WLST嵌入模式罐子,它的weblogic.jar

0

Asumming您的WLS域位于/ ORACLE /应用/ ORACLE/gc_inst/user_projects /域/ GCDomain ,以下WLST命令为我工作的WLS10.3.6,让我们能够RuntimeMBeanServer:

1)使能平台MBean服务器,如果禁用: 1.1。在WLS管理控制台中,转至GCDomain> Configuration> General> Advanced 1.2。选择平台MBean服务器已启用,保存更改并激活更改。 1.3。重新启动管理服务器。

2)有利于GCDomain

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

3 ENV变量)从WLST 使RuntimeMBeanServerEnabled的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() 

希望它为你工作了。