首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

Accessing WebLogic Server MBeans with JMX (1)

2012-12-26 
Accessing WebLogic Server MBeans with JMX (一)From oracleExample: Connecting to the Domain Runtime

Accessing WebLogic Server MBeans with JMX (一)

From oracle

Example: Connecting to the Domain Runtime MBean Server

?

public class MyConnection {

???private static MBeanServerConnection connection;???private static JMXConnector connector;???private static final ObjectName service;

???/*???* Initialize connection to the Domain Runtime MBean Server.???*/???public static void initConnection(String hostname, String portString,??????String username, String password) throws IOException,??????MalformedURLException {

??????String protocol = "t3";??????Integer portInteger = Integer.valueOf(portString);??????int port = portInteger.intValue();??????String jndiroot = "/jndi/";??????String mserver = "weblogic.management.mbeanservers.domainruntime";

??????JMXServiceURL serviceURL = new JMXServiceURL(protocol, 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");??????h.put("jmx.remote.x.request.waiting.timeout", new Long(10000));??????connector = JMXConnectorFactory.connect(serviceURL, h);??????connection = connector.getMBeanServerConnection();???}

???public static void main(String[] args) throws Exception {??????String hostname = args[0];??????String portString = args[1];??????String username = args[2];??????String password = args[3];

??????MyConnection c= new MyConnection();??????initConnection(hostname, portString, username, password);...??????connector.close();???}}

The WebLogic Server? MBean Reference AT:

http://download.oracle.com/docs/cd/E11035_01/wls100/wlsmbeanref/core/index.html


 

热点排行