ALSBConfigurationMBean
Make sure you also have
Oracle_OSB1\lib\sb-kernel-api.jar
Oracle_OSB1\modules\com.bea.common.configfwk_1.5.0.0.jar
in your classpath.
package com.pierre.osb.doc; import java.util.Hashtable; import java.util.Set; import javax.management.JMX; import javax.management.MBeanServerConnection; import javax.management.ObjectName; import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXServiceURL; import javax.naming.Context; import weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean; import com.bea.wli.config.Ref; import com.bea.wli.sb.management.configuration.ALSBConfigurationMBean; import com.bea.wli.sb.management.configuration.SessionManagementMBean; public class ListProjects { String hostname = "acme.com"; int port = 7001; String username = "Pierluigi"; String password = "weblogic1"; public static void main(String[] args) throws Exception { ListProjects listProjects = new ListProjects(); listProjects.display(); } public void display() throws Exception { JMXServiceURL serviceURL = new JMXServiceURL("t3", hostname, port, "/jndi/" + DomainRuntimeServiceMBean.MBEANSERVER_JNDI_NAME); Hashtable<String, String> h = new Hashtable<String, String>(); h.put(Context.SECURITY_PRINCIPAL, username); h.put(Context.SECURITY_CREDENTIALS, password); h.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "weblogic.management.remote"); JMXConnector conn = JMXConnectorFactory.connect(serviceURL, h); System.out.println("connected"); try { System.out.println("Opened JMX connection to " + hostname + ":" + port + " as " + username); // get mbean connection MBeanServerConnection mbconn = conn.getMBeanServerConnection(); // Get SessionmanagementMBean SessionManagementMBean sm = JMX.newMBeanProxy(mbconn, ObjectName.getInstance(SessionManagementMBean.OBJECT_NAME), SessionManagementMBean.class); // Create a session String sessionName = "MySession"; sm.createSession(sessionName); // Get the configuration MBean for the session, do stuff, and then discard the session. try { System.out.println("Session exists? : " + sm.sessionExists(sessionName)); ALSBConfigurationMBean configMBean = JMX.newMBeanProxy( mbconn, ObjectName.getInstance("com.bea:Name=" + ALSBConfigurationMBean.NAME + "." + sessionName + ",Type=" + ALSBConfigurationMBean.TYPE), ALSBConfigurationMBean.class ); System.out.println("Got the config MBean for session: " + configMBean.getSession()); Set<Ref> refs = configMBean.getRefs(Ref.DOMAIN); System.out.println("found " + refs.size() + " refs<br>"); for (Ref ref : refs) { System.out.println(ref.getFullName() + " isProjectRef= " + ref.isProjectRef() + "<br>"); } } finally { // use activateSession to commit session changes instead sm.discardSession(sessionName); } } finally { conn.close(); System.out.println("Closed JMX connection"); } } }
Actually it seems to work with these JARs:
CL3Export.jar
CL3Nonexport.jar
com.bea.common.configfwk_1.5.0.0.jar
com.bea.core.common.security.api_1.0.0.0_6-1-0-0.jar
com.bea.core.descriptor_1.9.0.0.jar
com.bea.core.descriptor.wl_1.3.3.0.jar
com.bea.core.logging_1.8.0.0.jar
com.bea.core.management.core_2.8.0.0.jar
com.bea.core.management.jmx_1.4.1.0.jar
com.bea.core.messaging.kernel_1.8.0.0.jar
com.bea.core.store_1.7.0.0.jar
com.bea.core.timers_1.7.0.0.jar
com.bea.core.transaction_2.7.0.0.jar
com.bea.core.utils.classloaders_1.8.0.0.jar
com.bea.core.utils.expressions_1.4.0.0.jar
com.bea.core.utils.full_1.9.0.0.jar
com.bea.core.utils.wrapper_1.4.0.0.jar
com.bea.core.weblogic.lifecycle_1.4.0.0.jar
com.bea.core.weblogic.rmi.client_1.8.0.0.jar
com.bea.core.weblogic.rmi.client.ja_1.8.0.0.jar
com.bea.core.weblogic.security_1.0.0.0_6-1-0-0.jar
com.bea.core.weblogic.security.digest_1.0.0.0.jar
com.bea.core.weblogic.security.identity_1.1.2.1.jar
com.bea.core.weblogic.security.wls_1.0.0.0_6-1-0-0.jar
com.bea.core.weblogic.socket.api_1.2.0.0.jar
com.bea.core.weblogic.workmanager_1.9.0.0.jar
com.bea.core.weblogic.workmanager.ja_1.9.0.0.jar
connector.jar
dhbcore.jar
fscontext.jar
javax.jms_1.1.1.jar
JAXBClassesGeneration.jar
jms.jar
jndi.jar
jstl.jar
jta.jar
ldap.jar
org.eclipse.persistence_1.0.0.0_2-1.jar
sb-kernel-api.jar
standard.jar
weblogic.jar
wlclient.jar
No comments:
Post a Comment