[jboss-user] [JNDI/Naming/Network] - How to locate MDB MXbean via JNDI? (crosspost from EJB/JBoss

tajh do-not-reply at jboss.com
Thu Apr 16 17:22:20 EDT 2009


Sorry for the duplication; this is a cross-post from the EJB/JBoss Forum because I am not sure which one is the right forum.

Original post is here: 
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=154082

I've searched the documentation and the forums, wasn't able to find this particular issue addressed anywhere.

I have a MDB (called MyMDB) deployed in a JAR, and I have a custom JMX bean deployed in a SAR.  I would like to access the org.jboss.ejb.plugins.jms.JMSContainerInvokerMBean corresponding to my MDB so that the custom JMX bean can call the startDelivery() and stopDelivery() methods on the JMSContainerInvokerMBean.  So far, I have been unable to locate the JMSContainerInvokerMBean in JNDI from within the SAR.  

I have tried the following JNDI contexts, to no avail:

anonymous wrote : java:/comp/env/MyMDB
  | java:/com/MyMDB
  | java:/MyMDB
  | local/MyMDB
  | /MyMDB
  | MyMDB
  | 

The JNDIView service in the JMX Console reports the following:

anonymous wrote : Ejb Module: MyMDB.jar
  | 
  | java:comp namespace of the MyMDB bean:
  | 
  |   +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
  |   +- ORB (class: org.jacorb.orb.ORB)
  |   +- env (class: org.jnp.interfaces.NamingContext)
  | 

And of course I can access the desired JMSContainerInvokerMBean via the JMX console also, at something like the following:

anonymous wrote : jboss.j2ee
  | 
  |     * binding=message-driven-bean,jndiName=local/MyMDB at 9049759,plugin=invoker,service=EJB
  | 

That number following the @ sign seems to be different every time I start JBoss, and this JNDI name seems to only apply from within the MDB's JAR scope itself.  At first, I wasn't sure I could get access to the JMSContainerInvokerMBean from outside the MDB's JAR, but if the JMX Console can do it, I should be able to do it from within my custom JMX bean in my SAR.  

So does anyone know the correct JNDI path to construct to get a handle to this? 

For reference, I am running the following:
JBoss AS 4.2.2 GA
JBoss Messaging 1.0
Java SDK 1.5.0_12

And this is what my client JNDI lookup code looks like:

JMSContainerInvokerMBean mbean = null;
  | try {
  | 	Context context = new InitialContext();
  | 	mbean = (JMSContainerInvokerMBean)context.lookup(jndiName);
  | } catch (NamingException ne) {
  | 	log.error("Unable to retrieve JMSContainerInvokerMBean at JNDI context " + jndiName, ne);
  | } catch (ClassCastException ce) {
  | 	log.error("Object at JNDI context " + jndiName + " is not instance of JMSContainerInvokerMBean", ce);
  | }

Any help is appreciated.

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

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



More information about the jboss-user mailing list