Jms 使用WLST的消息传递网桥状态
我正在尝试构建一个WLST脚本,它告诉我AdminServer上n个消息传递桥的状态Jms 使用WLST的消息传递网桥状态,jms,wlst,Jms,Wlst,我正在尝试构建一个WLST脚本,它告诉我AdminServer上n个消息传递桥的状态 connect('uname','pswd','t3://localhost:7001'); serverRuntime(); bd= cmo.getMessagingBridgeRuntime(); print bd.getName(); print bd.getState(); 我在查找mbean实例时遇到问题,错误如下: 属性错误:getMessagingBridgeRuntime 如果你已经有
connect('uname','pswd','t3://localhost:7001');
serverRuntime();
bd= cmo.getMessagingBridgeRuntime();
print bd.getName();
print bd.getState();
我在查找mbean实例时遇到问题,错误如下:
属性错误:getMessagingBridgeRuntime
如果你已经有了这个正在运行的脚本或者帮助我解决这个问题,这将是非常有帮助的
我正在使用weblogic 10.3.1以下是查找网桥状态的JMX java代码
import javax.management.MBeanServerConnection;
import java.net.MalformedURLException;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
import javax.naming.Context;
import java.util.*;
public class GetMessageBridgeStatus {
private static MBeanServerConnection connection;
private static JMXConnector connector;
public static void getMessageBridgeStatus(String hostname2,String port2,String username2,String password2,String wlname2, List<String> bridgeName) {
try
{
String hostname=hostname2;
String port=port2;
String username=username2;
String password=password2;
String wlname=wlname2;
getRuntimeMBeanServerConnection(hostname,port,username,password);
Iterator<String> iterator = bridgeName.iterator();
while(iterator.hasNext()){
String bName = iterator.next();
String bs = "com.bea:ServerRuntime="+wlname+",Name="+bName+",Type=MessagingBridgeRuntime,Location=" +wlname;
ObjectName service = new ObjectName(bs);
String status = connection.getAttribute(service,"State").toString();
String description = connection.getAttribute(service,"Description").toString();
System.out.println("Name: "+bName+" ::: Status: "+status +" ::: Description: "+description);
}catch(Exception e) {
e.printStackTrace();
}
}
public static void getRuntimeMBeanServerConnection(String hostname1,String port1,String username1,String password1) throws Exception{
String jndiroot = "/jndi/";
String mserver = "weblogic.management.mbeanservers.domainruntime";
String hostname=hostname1;
String username=username1;
String password=password1;
Integer portInteger = Integer.valueOf(port1);
int port = portInteger.intValue();
JMXServiceURL serviceURL = new JMXServiceURL("t3", hostname, port,jndiroot + mserver);
Hashtable h = new Hashtable();
h.put(Context.SECURITY_PRINCIPAL, username);
h.put(Context.SECURITY_CREDENTIALS, password);
h.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES,"weblogic.management.remote");
connector = JMXConnectorFactory.connect(serviceURL, h);
connection = connector.getMBeanServerConnection();
}
}
import javax.management.MBeanServerConnection;
导入java.net.MalformedURLException;
导入javax.management.ObjectName;
导入javax.management.remote.JMXConnector;
导入javax.management.remote.JMXConnectorFactory;
导入javax.management.remote.JMXServiceURL;
导入javax.naming.Context;
导入java.util.*;
公共类GetMessageBridgeStatus{
私有静态MBeanServer连接;
专用静态JMXConnector连接器;
公共静态void getMessageBridgeStatus(字符串hostname2、字符串port2、字符串username2、字符串password2、字符串wlname2、列表bridgeName){
尝试
{
字符串hostname=hostname2;
字符串端口=端口2;
字符串username=username2;
字符串密码=密码2;
字符串wlname=wlname2;
getRuntimeMBeanServerConnection(主机名、端口、用户名、密码);
迭代器迭代器=bridgeName.Iterator();
while(iterator.hasNext()){
String bName=iterator.next();
String bs=“com.bea:ServerRuntime=“+wlname+”,Name=“+bName+”,Type=MessagingBridgeRuntime,Location=“+wlname;
ObjectName服务=新的ObjectName(bs);
字符串状态=connection.getAttribute(服务,“状态”).toString();
字符串描述=connection.getAttribute(服务,“描述”).toString();
System.out.println(“名称:+bName+”::状态:+Status+::说明:+Description”);
}捕获(例外e){
e、 printStackTrace();
}
}
公共静态void getRuntimeMBeanServerConnection(字符串hostname1、字符串port1、字符串username1、字符串password1)引发异常{
字符串jndiroot=“/jndi/”;
String mserver=“weblogic.management.mbeanservers.domainruntime”;
字符串hostname=hostname1;
字符串username=username1;
字符串密码=密码1;
整数portinger=Integer.valueOf(port1);
int port=portInteger.intValue();
JMXServiceURL serviceURL=新的JMXServiceURL(“t3”,主机名,端口,jndiroot+mserver);
Hashtable h=新的Hashtable();
h、 put(Context.SECURITY\u主体,用户名);
h、 put(Context.SECURITY\u凭证、密码);
h、 put(JMXConnectorFactory.PROTOCOL_PROVIDER_包,“weblogic.management.remote”);
connector=JMXConnectorFactory.connect(serviceURL,h);
connection=connector.getMBeanServerConnection();
}
}
在serverRuntime()命令之后执行ls()并检查是否看到“MessagingBridgeRuntime”在ls output.oops!中,它不存在,但为什么它不存在?我需要这段脚本才能工作,还有其他建议吗?这似乎是因为Weblogic 9.2到10.3.5中存在错误。请检查您的版本是否有相应的补丁,或者按照