0 Replies Latest reply on Sep 30, 2003 8:16 AM by rhcp

    lookup() returns null

    rhcp Newbie

      Hi,

      I would like to create a user MBean with the "ServiceMBeanSupport" interface (Listing 2-18 from the JBossBook_321). My service.xml looks like the following:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE server>




      helloService
      jboss:service=Naming




      The example of the user MBean implementation does
      nothing but rebind a reference of a HashMap on the specified JNDI name "helloService" from my service.xml.


      HashMap contextMap= new HashMap();
      InitialContext rootCtx= new InitialContext();
      Name fullName = rootCtx.getNameParser("").parse
      (jndiName);
      log.info("service Name="+fullName);
      NonSerializableFactory.rebind(fullName,contextMap);


      The client code runs in a main and like to get the
      reference of the binded HashMap.


      InitialContext ctx = new InitialContext();
      HashMap t= (HashMap)ctx.lookup("helloService");
      boolean boo=t.isEmpty();


      The JBoss server runs without problems in my console and adds my new MBean (MyFirstService). There is no problem to view the user MBean in the jmx-console. But when I start the client I get always a Null from the lookup method (No NotBoundException).

      How can I get a reference to my new MBean?

      Thanks in advance