I am trying to access a MBean service deployed into JBOSS AS 7.1.1. My MBean service is also a Queue Listener. I am trying to get an instance of this MBean service to register it as a Queue Listener in another SAR.
I tried out this code but it is not working,
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
ObjectName mbeanObject =
new ObjectName("myproject.service.Test:service=com.mytest.program");
TestServiceMBean handler = MBeanServerInvocationHandler.newProxyInstance(
server, mbeanObject, TestServiceMBean.class, false);
I also tried out this
TestServiceMBean testMBeanService =
(TestServiceMBean)server.getAttribute(mbeanObject, "Instance");
In both the cases I am not getting the instance of the TestServiceMBean
. Can anyone please help me in getting the access to MBean Test service.
<mbean code="com.mytest.program.TestService"
name="myproject.service.Test:service=com.mytest.program">
</mbean>
Here's the code:
public class TestService implements TestServiceMBean, MessageListener {