org.springframework.jmx.support
public class: WebLogicJndiMBeanServerFactoryBean [javadoc |
source]
java.lang.Object
org.springframework.jndi.JndiAccessor
org.springframework.jndi.JndiLocatorSupport
org.springframework.jmx.support.WebLogicJndiMBeanServerFactoryBean
All Implemented Interfaces:
InitializingBean, FactoryBean
FactoryBean that obtains a specified WebLogic
javax.management.MBeanServer
reference through a WebLogic
MBeanHome obtained via a JNDI lookup.
By default, the server's local
MBeanHome will be obtained.
Exposes the MBeanServer for bean references.
This FactoryBean is a direct alternative to MBeanServerFactoryBean ,
which uses standard JMX 1.2 API to access the platform's MBeanServer.
Note: There is also a more general WebLogicMBeanServerFactoryBean
for accessing any specified WebLogic MBeanServer,
potentially a remote one.
NOTE: This class is only intended for use with WebLogic 8.1.
On WebLogic 9.x, simply obtain the MBeanServer directly from the JNDI location
"java:comp/env/jmx/runtime", for example through the following configuration:
<bean class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jmx/runtime"/>
</bean>
| Method from org.springframework.jmx.support.WebLogicJndiMBeanServerFactoryBean Detail: |
public void afterPropertiesSet() throws MBeanServerNotFoundException {
try {
String jndiName = this.mbeanHomeName;
if (jndiName == null) {
/*
* jndiName = MBeanHome.LOCAL_JNDI_NAME;
*/
Class mbeanHomeClass = getClass().getClassLoader().loadClass(WEBLOGIC_MBEAN_HOME_CLASS);
jndiName = (String) mbeanHomeClass.getField(LOCAL_JNDI_NAME_FIELD).get(null);
}
Object mbeanHome = lookup(jndiName);
/*
* this.mbeanServer = mbeanHome.getMBeanServer();
*/
this.mbeanServer = (MBeanServer)
mbeanHome.getClass().getMethod(GET_MBEAN_SERVER_METHOD, null).invoke(mbeanHome, null);
}
catch (NamingException ex) {
throw new MBeanServerNotFoundException("Could not find WebLogic's MBeanHome object in JNDI", ex);
}
catch (ClassNotFoundException ex) {
throw new MBeanServerNotFoundException("Could not find WebLogic's MBeanHome class", ex);
}
catch (InvocationTargetException ex) {
throw new MBeanServerNotFoundException(
"WebLogic's MBeanHome.getMBeanServer method failed", ex.getTargetException());
}
catch (Exception ex) {
throw new MBeanServerNotFoundException(
"Could not access WebLogic's MBeanHome/getMBeanServer method", ex);
}
}
|
public Object getObject() {
return this.mbeanServer;
}
|
public Class getObjectType() {
return (this.mbeanServer != null ? this.mbeanServer.getClass() : MBeanServer.class);
}
|
public boolean isSingleton() {
return true;
}
|
public void setMbeanHomeName(String mbeanHomeName) {
this.mbeanHomeName = mbeanHomeName;
}
|