2 Replies Latest reply on Sep 30, 2006 12:01 AM by Andrew Rubinger

    NoSuchObjectException

    Deepak Nohwal Newbie

      Hi,

      I have a peculiar problem which I am unable to decipher. Please allow me to explain it.

      I have an instance of JBoss server running on a box A(IP: 10.8.24.250). On another box B(IP: 10.8.24.236), I am trying to lookup an EJB deployed on the JBoss server on A. The code looks like the following:

      
      import java.util.Hashtable;
      
      import java.net.Socket;
      import javax.ejb.EJBHome;
      import javax.naming.Context;
      import javax.naming.InitialContext;
      import javax.naming.NamingEnumeration;
      import javax.naming.NamingException;
      import javax.rmi.PortableRemoteObject;
      
      public class SchedulerClient
      {
       public static void main(String[] args) throws Exception
       {
       Hashtable props = new Hashtable();
       props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
       props.put(Context.PROVIDER_URL, "10.8.24.250:1099");
       InitialContext ctx = new InitialContext(props);
       //Socket sock = new Socket("10.8.24.250", 1099);
       //System.out.println("The socket has been created successfully: "+ sock);
       Object obj = ctx.lookup("com.abc.scheduler.ejb.SchedulerManager");
       SchedulerManagerHome home = (SchedulerManagerHome) PortableRemoteObject.narrow(obj, SchedulerManagerHome.class);
       System.out.println("Got the home object :" + home);
       System.out.println("Got the ejb object :" + home.create());
       }
      }
      


      If I run this client application on box A, it works absolutely fine and returns me the correct EJB instance.

      However, if I run the same code from machine B, it throws me the following error:

      2006-09-14 05:10:27,442 ERROR [com.nubridges.framework.ejb.EJBHomeFactory] Caught Throwable javax.naming.CommunicationException - javax.naming.CommunicationException [Root exception is java.rmi.NoSuchObjectException: no such object in table] - in EJBHomeFactory.lookupHome jn=com.abc.scheduler.ejb.SchedulerManager;hc=com.abc.scheduler.ejb.SchedulerManagerHome
      javax.naming.CommunicationException [Root exception is java.rmi.NoSuchObjectException: no such object in table]
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:707)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at SchedulerClient.lookup(...)


      I fail to understand the reason. Both the boxes are Linux boxes running with Java 5. The JBoss version in 4.0.2.

      One more thing, if both the boxes are windows boxes, the same code works fine on both of them. Any clues what am I doing wrong?

      Thanks,
      Deepak.
      dnohwal@yahoo.com