-
Dec 11th, 2008, 06:13 AM
#1
Register custom MBeans in weblogic MBean server
We have an app running in weblogic 9.2 and I am having problems registering custom MBeans with Weblogic's MBeans Runtime MBean server. For security reasons we are registering the custom MBeans specifically with the runtime MBean Server. I tried 2 approaches, one using the spring configuration and the second programmatically. Neither was successful.
Approach 1
----------
We are using a spring configuration file to create and register the MBeans and inject the MBeanServer. According to the spring documentation the Runtime MBean server can be injected via
JNDI:
<bean id="mbeanServer" class="org.springframework.jndi.JndiObjectFactoryB ean" >
<property name="jndiName" value="java:comp/env/jmx/runtime" />
</bean>
However, when the application loads up only Weblogic's own MBeans (domain com.bea) actually being registered with the MBeanServer. I have verified this is happening both by connecting to the MBeanServer programtically using the weblogic t3s protocol, and also by using the Weblogic scripting language.
Approach 2
----------
I tried an alternative approach which was to register the custom MBeans programatically and still had problems. From within our application I get a JNDI connection to the RuntimeMBeanServer and then attempt to register the Bean using:
javax.naming.InitialContext ctx = new javax.naming.InitialContext();
javax.management.MBeanServer server = (javax.management.MBeanServer)ctx.lookup
("java:comp/env/jmx/runtime");
server.createMBean(
"com.gmacfs.wholesale.systemmonitor.EnvironmentAge nt",
new javax.management.ObjectName("jcTOOL:name=Environme ntAgent"));
In this case I get a: java.lang.ClassNotFoundException:
com.gmacfs.wholesale.systemmonitor.EnvironmentAgen t
at com.sun.jmx.mbeanserver.ClassLoaderRepositorySuppo rt.loadClass
(ClassLoaderRepositorySupport.java:208)
at com.sun.jmx.mbeanserver.ClassLoaderRepositorySuppo rt.loadClass
(ClassLoaderRepositorySupport.java:128)
at com.sun.jmx.mbeanserver.MBeanInstantiatorImpl.find ClassWithDefaultLoaderRepository
(MBeanInstantiatorImpl.java:57)
I wondered if weblogic was not finding the custom classes. I added the application's jar to the weblogic startup classpath and restarted, but still got the same error.
--------
Note, that if we set the WebLogic Server Runtime MBean Server to be the platform MBean server then the custom Beans are registered in addition to bea's own beans and the JDK's language beans. This however is not an option because it is not secure.
Can anyone help with either approach, or can suggest why the custom MBeans are not being registered with the runtime MBean server?
many thanks
Paul
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules