4 Replies Latest reply on Oct 27, 2004 7:38 AM by Dilip Padhee

    Couldn't lookup

    Dilip Padhee Newbie


      Couldn't get ManagementHome and getting exception "ejb not bound"...
      My program is like the below.

      -----------------------------------
      Properties props = new Properties();
      props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
      props.put(Context.SECURITY_PRINCIPAL, "");
      props.put(Context.SECURITY_CREDENTIALS, "");
      try{
      InitialContext context= new InitialContext(props);
      Object o = context.lookup( "ejb/mgmt/MEJB" );
      ManagementHome home = (ManagementHome) PortableRemoteObject.narrow(o,ManagementHome.class);
      Management mejb = home.create();
      ObjectName searchpattern = new ObjectName(args[1]);
      Set managedObjects = mejb.queryNames(searchpattern,null);
      System.out.println( "Found " + managedObjects.size() + " matching Managed Objects.");
      }catch(Exception ee){
      System.out.println("Error: -> "+ee.getMessage());
      }
      ---------------------------------

      Pl. help me.

      Thanks