1 Reply Latest reply on Dec 18, 2006 8:09 AM by Anatoly Kochubey

    JBoss server restart  and java.rmi.NoSuchObjectException: no

    Ariel Newbie

      I am running into an issue with remote object lookup after a Jboss Server restart.
      I am running JBoss 4.0.5 GA.
      I have a test case that does the following -
      *test client creates Init Context with properties and successfully looks up a remote EJB interface.
      *test client closes init context
      *test client sleeps for 45 seconds.

      *In the meanwhile the JBoss server is restarted.

      *The test client wakes up and creates a new initial context with same props as before
      *Test client tries to look up the same remote EJB interface as before.This time the look up fails with java.rmi.NoSuchObjectException: no such object in table.
      *Even if the test client looks up a different remote EJB interface the same exception is thrown

      The relevant code snippet from the test client is below

      InitialContext ctx = new InitialContext();
      Object beanobj = ctx.lookup("MyService/RemoteIAdmin");
      try {
       System.out.println("Waiting for 35 seconds. Restart Jboss now!!");
       Thread.sleep(45 * 1000); // wait for 30 seconds
       System.out.println("Done sleeping. Will do second lookup now");
      } catch (InterruptedException e) {
      InitialContext ctx_1 = new InitialContext();
      Object beanobj_1 = ctx.lookup("MyService/RemoteIAdmin");

      The exception occurs on the second lookup the stack trace is as follows
      javax.naming.CommunicationException [Root exception is java.rmi.NoSuchObjectException: no such object in table]
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
       at javax.naming.InitialContext.lookup(Unknown Source)
      Caused by: java.rmi.NoSuchObjectException: no such object in table
       at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
       at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
       at sun.rmi.server.UnicastRef.invoke(Unknown Source)
       at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
       ... 19 more

      I turned on rmi debug for both server and client using -Dsun.rmi.loader.logLevel=verbose but I wasnt able to discern much from the log output

      I did a bit of reading on the jboss forums and wiki but none of the solutions listed has helped me. Readings include