3 Replies Latest reply on Aug 30, 2007 7:47 AM by shankha

    MDB  InstanceNotFoundException +MBean

    shankha

      Hi,
      I deploy a simple MDB (MessageEJB) in JBOSS.
      In the jboss.j2ee in the JMX console MBean responsible for operating the MessageEJB is JMSContainerInvoker.

      MBean Name: Domain Name: jboss.j2ee
      service: EJB
      plugin: invoker
      binding: message-driven-bean
      jndiName: local/MessageEJB@14023097
      MBean Java Class: org.jboss.ejb.plugins.jms.JMSContainerInvoker

      Binding name is

      binding=message-driven-bean,jndiName=local/MessageEJB@14023097,plugin=invoker,service=EJB

      In the code I have to look up the Object Name in the below mentioned way

      MBeanServerConnection mconn = (MBeanServerConnection)ctx.lookup("jmx/invoker/RMIAdaptor");
      
      ObjectName name = new ObjectName("jboss.j2ee:service=EJB,plugin=invoker,binding=message-driven-bean,jndiName=local/MessageEJB@32008150");
      
      Object val = mconn.getAttribute(name, "Name");
      ObjectInstance objInst = mconn.getObjectInstance(name);
      
      System.out.println(name + "\n\tObject Instance Class Name =" + objInst.getClassName());

      But for each and every time when I restart /deploy the JBOSS @32008150 is getting changed.

      And I am getting
      javax.management.InstanceNotFoundException: jboss.j2ee:service=EJB,plugin=invoker,binding=message-driven-bean,jndiName=local/MessageEJB@14023097 is not registered.

      How can I solve this problem?


        • 1. Re: MDB  InstanceNotFoundException +MBean
          jaikiran
          • 2. Re: MDB  InstanceNotFoundException +MBean
            shankha

            I update my jboss.xml by adding local-jndi-name TestMessageEJB.


            <jboss>
             <enterprise-beans>
             <session>
             <ejb-name>MBeanTestEJB</ejb-name>
             <jndi-name>MBeanTestEJB</jndi-name>
             </session>
             <message-driven>
             <ejb-name>MessageEJB</ejb-name>
             <destination-jndi-name>queue/testQueue</destination-jndi-name>
             <local-jndi-name>TestMessageEJB</local-jndi-name>
             </message-driven>
             </enterprise-beans>
            </jboss>



            In the Java code I update it following way

            try{
            
             Object name = jndiCtx.lookup("TestMessageEJB");
            
             //ObjectName name = new ObjectName("jboss.j2ee:service=EJB,plugin=invoker,binding=message-driven-bean,jndiName=local/MessageEJB");
             ObjectName objName = new ObjectName((String)name);
             MBeanInfo objMBeanInfo = mbeanServer.getMBeanInfo(objName);
             System.out.println("@@ -- MBeanTestBean :invokeMBeanFeatures : "+objMBeanInfo.getClassName());
            
             }catch(Exception ex){
            
             ex.printStackTrace();
             }


            I got the javax.naming.NameNotFoundException: TestMessageEJB not bound.

            Can any body please help me ?

            • 3. Re: MDB  InstanceNotFoundException +MBean
              shankha

              Problem is getting solved.

              I did some mistake in the jboss.xml file.

              <message-driven>
               <ejb-name>MessageEJB</ejb-name>
               <destination-jndi-name>queue/testQueue</destination-jndi-name>
               <local-jndi-name>MessageEJB</local-jndi-name>
               </message-driven>


              Here local-jndi-name should be equal to the ejb-name.

              And I find

              jboss.j2ee:service=EJB,plugin=invoker,binding=message-driven-bean,jndiName=MessageEJB


              @ is removed.

              :)