0 Replies Latest reply on Jul 17, 2006 12:04 PM by amarsyed

    unable to lookup remote mbean when newly added server is sti

    amarsyed

      We are facing an issue when trying to remotely connect to an MBeanServer of a node when it is added to a cluster. We try to look up jmx/invoker/RMIAdaptor but get an error stating that "jmx is not bound".

      We have one Windows machine running three instances of JBoss4.0.4GA.PATCH1. I start one server up, called default, and once it has finished I start the second called Routing. Both servers know of each other as it shows the following message on Routing.

      -------------------------------------------------------------------------------------------------------------
      [DefaultPartition] Number of cluster members: 2
      [DefaultPartition] Other members: 1
      [DefaultPartition] Fetching state (will wait for 30000 milliseconds):
      -------------------------------------------------------------------------------------------------------------

      On the default server we have an object listening as an implementation of org.jboss.ha.framework.interfaces.HAPartition$HAMembershipListener. As it receives a membershipChanged event we have the following code invoked through a spawned thread. This fails with the exception shown further below. However, once we add a hard coded sleep within this new spawned thread of 2 minutes then it works successfully. It seems as though the remote server, Routing has not finished initialising and registered the RMIAdaptor even though an event has been received at the default server. Can anyone help.


      static MBeanServer getRemoteMBeanServer(String node) throws JbossNodeManagerException
       {
       log.debug("->getRemoteMBeanServer( "+node+")");
      
       Properties jndiProperties = new Properties();
       jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
       jndiProperties.put(Context.PROVIDER_URL, "jnp://" + node);
       jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      // p.put(Context.PROVIDER_URL, "jnp://" + node);
       try{
       InitialContext ctx = new InitialContext(jndiProperties);
       log.debug("looking up with initial context:" + ctx);
       Object obj = ctx.lookup(DEFAULT_JNDI_NAME);
       log.debug("looked up rmi adaptor object: " + obj);
       RMIAdaptor rmiAdaptor = (RMIAdaptor) obj;
       return new MBeanServerAdaptorDelegate(rmiAdaptor);
       }catch(NamingException e){
       throw new JbossNodeManagerException("Unable to lookup remote mbean server for node '"+node+"' using jndi name: " +
       DEFAULT_JNDI_NAME,e);
       }
       }


      ##############Exception StackTrace##########################################################################################################
      xMP Engine: 2006-07-17 15:32:21,793 [com.vicorp.xmp.engine.management.nodemanager.jboss.JbossNodeManager$NewNodeHandlerThread] ERROR - Couldn't add new new node
      com.vicorp.xmp.engine.management.nodemanager.jboss.JbossNodeManagerException: Unable to lookup remote mbean server for node '162.13.51.79:1299' using jndi name: jmx/invoker/RMIAdaptor
      at com.vicorp.xmp.engine.management.nodemanager.jboss.JbossUtils.getRemoteMBeanServer(JbossUtils.java:110)
      at com.vicorp.xmp.engine.management.nodemanager.jboss.JbossUtils.getRemoteNodeName(JbossUtils.java:126)
      at com.vicorp.xmp.engine.management.nodemanager.jboss.JbossNodeManager.serverAdded(JbossNodeManager.java:257)
      at com.vicorp.xmp.engine.management.nodemanager.jboss.JbossNodeManager$NewNodeHandlerThread.run(JbossNodeManager.java:709)
      at java.lang.Thread.run(Thread.java:534)
      Caused by: javax.naming.NameNotFoundException: jmx not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:534)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at com.vicorp.xmp.engine.management.nodemanager.jboss.JbossUtils.getRemoteMBeanServer(JbossUtils.java:54)
      ... 4 more

      ##############Exception StackTrace##########################################################################################################