6 Replies Latest reply on Apr 26, 2003 10:38 AM by Juha Lindfors

    MBean invisible outside JBoss

    John Lindsey Newbie

      I created my own MBean ala the example in the JBoss docs. When it is started, it launches a thread that does various unimportant stuff and also binds itself via JNDI:

      [code ripped from the example]
      InitialContext context = new InitialContext();
      Name name = context.getNameParser( "" ).parse( jndiName );
      NonSerializableFactory.rebind( name, this, true );

      I then deploy other MBeans that lookup the first MBean via JNDI and use it.

      [more ripped code]
      InitialContext context = new InitialContext();
      Engine engine = (Engine) context.lookup( "Engine" );
      // do stuff with engine //

      All of this works like a charm.

      But I then tried to write a standalone client (i.e., NOT an MBean that I was deploying along with my Engine) that looked up the same MBean using code exactly like that above. It works (there are no exceptions), but lookup() always returns null.

      To check my sanity, I stopped my JBoss server and reran my client. I got the expected connection refused. I then started it back up but did not deploy my MBean. I got the expected not found error. Then I deployed the MBean, but tried looking up the wrong name. Once again, I got the expected message. Then I use the right name and get the null object.

      I'm completely at a loss here. Ideas?

      --
      John Lindsey