[Management, JMX/JBoss] - MBeanServerConnection & JRMPInvokerProxy problem
by danezu
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
17 years, 2 months
[Management, JMX/JBoss] - Re: jboss.tomcat.connectors.started JMX Notification Gone?
by remy.maucherat@jboss.com
Connector start is very similar now: it comes from the start notification of JBoss. So adding it back is not so useful, but it does compatibility.
/**
| * Used to receive notification of the server start msg so the tomcat connectors can be started after all web apps
| * are deployed.
| */
| public void handleNotification(Notification msg, Object handback)
| {
| String type = msg.getType();
| if (type.equals(Server.START_NOTIFICATION_TYPE))
| {
| log.debug("Saw " + type + " notification, starting connectors");
| try
| {
| startConnectors();
| }
| catch (Exception e)
| {
| log.warn("Failed to startConnectors", e);
| }
| }
| if (type.equals(Server.STOP_NOTIFICATION_TYPE))
| {
| log.debug("Saw " + type + " notification, stopping connectors");
| try
| {
| stopConnectors();
| }
| catch (Exception e)
| {
| log.warn("Failed to stopConnectors", e);
| }
| }
| }
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4210701#4210701
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4210701
17 years, 2 months