7 Replies Latest reply on Aug 9, 2013 5:55 AM by arnoldjohansson

    How to view all of the JNDI name in jboss7?

    andy215

      In JBOSS5, we can access the jmx-console by ip:port/jmx-console, and we can see the all of the JNDI name by JNDIView.

      But in JBOSS7, I just can see several JNDI name on the container/naming page. I want to lookup a MBean by new InitalContext().lookup("jndiName"),  jboss report naming not found. So how can I get all of the JNDI naming on JBOSS JNDI server?

        • 1. Re: How to view all of the JNDI name in jboss7?
          welle

          I'm not sure I understand what you want. The JNDI viewer in the management console shows you all that is bound in the JNDI (from what I know though).

           

          Why would you use JNDI to lookup a MBean and not the MBean server?

          • 2. Re: How to view all of the JNDI name in jboss7?
            andy215

            In the JBoss5, if we register a mbean to mbean server, this mbean will be binded with a JNDI name automaticlly. By the preview JBoss versions, we also can lookup MBeanServer by a JNDI name. Add we can lookup all of the mbeans(registered to boss mbean server by ourself) by JNDI name. But for JBoss7, I can't lookup these MBeans.

            • 3. Re: How to view all of the JNDI name in jboss7?
              welle

              Aha!  The correct way is to use the JMX standard of looking up MBeans (and the getting access to the MBeanServer) and NOT going through JNDI. I guess your client is local (in the JBoss VM) and not remote, or?

              • 4. Re: How to view all of the JNDI name in jboss7?
                arnoldjohansson

                For AS7 you perform remote access to a JMX MBean with the new jmx-remoting protocol. See code sample here.

                Note that you might need to enable the server to accept incoming calls. See comment in code sample for this.

                1 of 1 people found this helpful
                • 5. Re: How to view all of the JNDI name in jboss7?
                  andy215

                  Because by JNDI I can lookup a remote object as a local stub, then I can invoke remote object's method like it's in the local JVM. I don't whether JBoss7 don't register every mbean to JNDI server automaticlly. By for JBoss5, I can do this. And I don't think JBoss7 remove this good feature.

                  • 6. Re: How to view all of the JNDI name in jboss7?
                    andy215

                    So we only can access the remote mbean by the MBeanconnection, if so, that's really bad. Because in JBoss5, I can get a remote mbean by JNDI lookup, then I can invoke the remote mbean's method like what happens in local JVM. I can't believe JBoss7 removed this feature.

                     

                    JNDI code(vey simple)

                    // define remote ip, port and authtication parameters in this hashtable.

                    Hashtable hashtable;

                    InitialContext ctx = new InitialContext(hashtable);

                    User user = (User) ctx.lookup("java:/user");

                    System.out.println(user.getName());

                    • 7. Re: How to view all of the JNDI name in jboss7?
                      arnoldjohansson

                      Well, if you want/need to make that kind och calls you could make make the MBean a SLSB.