[jboss-user] [Management, JMX/JBoss] - MBeanServerConnection & JRMPInvokerProxy problem

danezu do-not-reply at jboss.com
Tue Feb 17 09:58:39 EST 2009

Hi guys

I'm new on this forum and i need you help pretty much

I use JMX to connect to a JBoss 4.2.2 GA with JBossMQ as messaging system.
I try to connect to the 'jmx/rmi/RMIAdaptor' using MBeanServerConnection, something like this:

Properties props = new Properties();
props.put(Context.PROVIDER_URL, "jnp://myurl:1099");
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");

Context ctx = new InitialContext(props);
MBeanServerConnection srvConn = (MBeanServerConnection)ctx.lookup("jmx/rmi/RMIAdaptor"); 
ObjectName oName = new ObjectName("jboss.mq.destination:name=testQueue,service=Queue");
Object attrValue = srvConn.getAttribute(oName, "QueueDepth");

It works perfectly when i run this as simple Java class, but when i try to launch it from some OSGi bundle, i get this error:

java.lang.ClassCastException: $Proxy13 cannot be cast to javax.management.MBeanServerConnection

where $Proxy13 proves to be an org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy instance.

I don't understand why in the first situation it works, and in the second doesn't

Can you please help me?

Thanx & regards

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4210717#4210717

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4210717

More information about the jboss-user mailing list