PDA

View Full Version : Exposing MBean in WebLogic 9



Andreas Senft
Dec 12th, 2007, 12:54 AM
Hi all,

I am currently trying to expose an MBean in WebLogic 9's MBean server.
First of all, using the simple approach works:



<context:mbean-export default-domain="${service.domain}"/>


However, I want to change the strategy for handling an existing instance. As the above mentioned tag just expands to an AnnotationMBeanExporter I tried this:



<bean class="org.springframework.jmx.export.annotation.Annotati onMBeanExporter"
p:registration-behavior-name="REGISTRATION_REPLACE_EXISTING"
p:autodetect-mode-name="AUTODETECT_ASSEMBLER"
p:default-domain="${service.domain}"
/>


Though, here things do not work as expected. It looks to me, as if publication does happen in another MBean-server and not the existing one.

Also this doesn't help:


<bean class="org.springframework.jmx.export.annotation.Annotati onMBeanExporter"
p:registration-behavior-name="REGISTRATION_REPLACE_EXISTING"
p:autodetect-mode-name="AUTODETECT_ASSEMBLER"
p:default-domain="${service.domain}"
p:server-ref="mbeanServer"
/>

<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactory Bean"
p:locate-existing-server-if-possible="true"
/>


I saw that in MBeanExportBeanDefinitionParser there is an invocation of MBeanServerBeanDefinitionParser.findServerForSpeci alEnvironment() which seems to make the difference. Now my question is, how do I have to configure things, so that the WebLogic MBean server is used?

BTW: Some more configuration properties in context:mbean-export might be helpful.

Regards,
Andreas

Andreas Senft
Dec 12th, 2007, 07:52 AM
I digged a bit further and came up with this solution, which works as expected:



<bean class="org.springframework.jmx.export.annotation.Annotati onMBeanExporter"
p:registration-behavior-name="REGISTRATION_REPLACE_EXISTING"
p:autodetect-mode-name="AUTODETECT_ASSEMBLER"
p:default-domain="${service.domain}"
p:server-ref="mbeanServer"
/>

<bean id="mbeanServer" class="org.springframework.jndi.JndiObjectFactoryBean"
p:jndi-name="java:comp/env/jmx/runtime"
p:proxy-interface="javax.management.MBeanServer"
/>


However, I find it a bit annoying that I cannot use context:mbean-export here. So I opened a Jira-issue, proposing an improvement in configurability:
http://opensource.atlassian.com/projects/spring/browse/SPR-4245