2 Replies Latest reply: Dec 7, 2006 9:12 AM by 666705 RSS

    PeerGoneException upon repeated InitialContext construction

    3004
      Hi there,

      I'm facing a problem with a WebLogic 5.1 installation on Linux running
      on a VMWare with NT 4.0 installed. I have a servlet running in a Tomcat
      3.2 environment under Linux. I'm retrieving a reference to the
      InitialContext using the following piece of code:

      public static Context getInitialContext(String connectString)
           throws Exception
      {
      Hashtable h = new Hashtable();
      h.put(Context.INITIAL_CONTEXT_FACTORY,
      "weblogic.jndi.WLInitialContextFactory");
      h.put(Context.PROVIDER_URL, connectString);

      return new InitialContext(h);
      }

      This works fine the first couple of times. Then, after not accessing the
      servlet for a while the next access would cause the following exception
      to be thrown:

      javax.naming.ServiceUnavailableException. Root exception is
      weblogic.rmi.NoSuchObjectException: The object identified by [2232] cou
      ld not because found. Either it was has not been exported or it has been
      collected by the distributed garbage collector.
      at
      weblogic.rmi.extensions.AbstractRequest.sendReceive(AbstractRequest.java:76)
      at
      weblogic.jndi.internal.RemoteContextFactoryImpl_WLStub.getContext(RemoteContextFactoryImpl_WLStub.java:95)
      at
      weblogic.jndi.WLInitialContextFactoryDelegate.newRemoteContext(WLInitialContextFactoryDelegate.java:316)
      at
      weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:242)
      at
      weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:205)
      at
      weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:148)
      at
      weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:123)
      at
      javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:669)
      at
      javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
      at javax.naming.InitialContext.init(InitialContext.java:223)
      at javax.naming.InitialContext.<init>(InitialContext.java:199)


      Then I thought I'd restart the server to see if that helps. I did so
      without restarting the Tomcat engine, expecting that a repeated lookup
      using the getInitialContext() method shown above should reconnect to the
      server, fetching a new valid reference to the InitialContext. Instead,
      now I'm getting the following exception:

      javax.naming.NamingException. Root exception is java.io.IOException:
      weblogic.rmi.extensions.RemoteRuntimeException: Undeclared checked
      exception - with nested exception:
      [weblogic.rjvm.PeerGoneException: Peer requested connection shutdown]
      at
      weblogic.rmi.extensions.AbstractRequest.sendReceive(AbstractRequest.java:76)
      at
      weblogic.jndi.internal.RemoteContextFactoryImpl_WLStub.getContext(RemoteContextFactoryImpl_WLStub.java:95)
      at
      weblogic.jndi.WLInitialContextFactoryDelegate.newRemoteContext(WLInitialContextFactoryDelegate.java:316)
      at
      weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:242)
      at
      weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:205)
      at
      weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:148)
      at
      weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:123)
      at
      javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:669)
      at
      javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
      at javax.naming.InitialContext.init(InitialContext.java:223)
      at javax.naming.InitialContext.<init>(InitialContext.java:199)
      ... more stuff...
      --------------- nested within: ------------------
      weblogic.rmi.UnexpectedException: Undeclared checked exception
      - with nested exception:
      [java.io.IOException: weblogic.rmi.extensions.RemoteRuntimeException:
      Undeclared checked exception - with nested exception:
      [weblogic.rjvm.PeerGoneException: Peer requested connection shutdown]]
      at weblogic.common.T3Exception.<init>(T3Exception.java:47)
      at weblogic.rmi.RemoteException.<init>(RemoteException.java:41)
      at
      weblogic.rmi.UnexpectedException.<init>(UnexpectedException.java:32)
      at
      weblogic.jndi.internal.RemoteContextFactoryImpl_WLStub.getContext(RemoteContextFactoryImpl_WLStub.java:121)
      at
      weblogic.jndi.WLInitialContextFactoryDelegate.newRemoteContext(WLInitialContextFactoryDelegate.java:316)
      at
      weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:242)
      at
      weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:205)
      at
      weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:148)
      at
      weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:123)
      at
      javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:669)
      at
      javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
      at javax.naming.InitialContext.init(InitialContext.java:223)
      at javax.naming.InitialContext.<init>(InitialContext.java:199)
      ...more stuff...


      What's going on here? I'd already be happy to know a way how I can work
      around this problem in my code, e.g. by a repeated lookup in case this
      exception occurs. Is there a way how I can get a valid InitialContext
      reference in my client despite this exception being thrown?

      Thanks,
      -- Axel

      ArcStyler - the IT-Architectural IDE for J2EE/EJB
      -> IBM Solution Excellence Award winner for Hot Java Solution
      -> European Information Society Technologies Prize Winner 2001
      -> free trial-version at http://www.ArcStyler.com
      ---- < iO > -----------------------------------------------------
      Interactive Objects Software GmbH
      mailto:axel.uhl@io-software.com
      http://www.io-software.com
      Basler Strasse 65, D-79100 Freiburg, Germany
      Tel: [+49]-761-40073-57, Fax: [+49]-761-40073-73

        • 1. Re: PeerGoneException upon repeated InitialContext construction
          3004
          The InitialContext only needs to be constructed in the lifetime of your servlet; add a member
          reference and initialize it in your Servlet.initialize().

          As for why it stops working for you after a few times, may be because you are forgetting to call
          Context.close() after each usage.... note if you do the above, then don't close it and don't worry
          about it!

          Gene

          "Axel Uhl" <axel.uhl@io-software.com> wrote in message news:3A8E6574.CB371E3@io-software.com...
          Hi there,

          I'm facing a problem with a WebLogic 5.1 installation on Linux running
          on a VMWare with NT 4.0 installed. I have a servlet running in a Tomcat
          3.2 environment under Linux. I'm retrieving a reference to the
          InitialContext using the following piece of code:

          public static Context getInitialContext(String connectString)
          throws Exception
          {
          Hashtable h = new Hashtable();
          h.put(Context.INITIAL_CONTEXT_FACTORY,
          "weblogic.jndi.WLInitialContextFactory");
          h.put(Context.PROVIDER_URL, connectString);

          return new InitialContext(h);
          }

          This works fine the first couple of times. Then, after not accessing the
          servlet for a while the next access would cause the following exception
          to be thrown:

          javax.naming.ServiceUnavailableException. Root exception is
          weblogic.rmi.NoSuchObjectException: The object identified by [2232] cou
          ld not because found. Either it was has not been exported or it has been
          collected by the distributed garbage collector.
          at
          weblogic.rmi.extensions.AbstractRequest.sendReceive(AbstractRequest.java:76)
          at
          weblogic.jndi.internal.RemoteContextFactoryImpl_WLStub.getContext(RemoteContextFactoryImpl_WLStub.ja
          va:95)
          at
          weblogic.jndi.WLInitialContextFactoryDelegate.newRemoteContext(WLInitialContextFactoryDelegate.java:
          316)
          at
          weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:242)
          at
          weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java
          :205)
          at
          weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java
          :148)
          at
          weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:123)
          at
          javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:669)
          at
          javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
          at javax.naming.InitialContext.init(InitialContext.java:223)
          at javax.naming.InitialContext.<init>(InitialContext.java:199)


          Then I thought I'd restart the server to see if that helps. I did so
          without restarting the Tomcat engine, expecting that a repeated lookup
          using the getInitialContext() method shown above should reconnect to the
          server, fetching a new valid reference to the InitialContext. Instead,
          now I'm getting the following exception:

          javax.naming.NamingException. Root exception is java.io.IOException:
          weblogic.rmi.extensions.RemoteRuntimeException: Undeclared checked
          exception - with nested exception:
          [weblogic.rjvm.PeerGoneException: Peer requested connection shutdown]
          at
          weblogic.rmi.extensions.AbstractRequest.sendReceive(AbstractRequest.java:76)
          at
          weblogic.jndi.internal.RemoteContextFactoryImpl_WLStub.getContext(RemoteContextFactoryImpl_WLStub.ja
          va:95)
          at
          weblogic.jndi.WLInitialContextFactoryDelegate.newRemoteContext(WLInitialContextFactoryDelegate.java:
          316)
          at
          weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:242)
          at
          weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java
          :205)
          at
          weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java
          :148)
          at
          weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:123)
          at
          javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:669)
          at
          javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
          at javax.naming.InitialContext.init(InitialContext.java:223)
          at javax.naming.InitialContext.<init>(InitialContext.java:199)
          ... more stuff...
          --------------- nested within: ------------------
          weblogic.rmi.UnexpectedException: Undeclared checked exception
          - with nested exception:
          [java.io.IOException: weblogic.rmi.extensions.RemoteRuntimeException:
          Undeclared checked exception - with nested exception:
          [weblogic.rjvm.PeerGoneException: Peer requested connection shutdown]]
          at weblogic.common.T3Exception.<init>(T3Exception.java:47)
          at weblogic.rmi.RemoteException.<init>(RemoteException.java:41)
          at
          weblogic.rmi.UnexpectedException.<init>(UnexpectedException.java:32)
          at
          weblogic.jndi.internal.RemoteContextFactoryImpl_WLStub.getContext(RemoteContextFactoryImpl_WLStub.ja
          va:121)
          at
          weblogic.jndi.WLInitialContextFactoryDelegate.newRemoteContext(WLInitialContextFactoryDelegate.java:
          316)
          at
          weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:242)
          at
          weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java
          :205)
          at
          weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java
          :148)
          at
          weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:123)
          at
          javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:669)
          at
          javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
          at javax.naming.InitialContext.init(InitialContext.java:223)
          at javax.naming.InitialContext.<init>(InitialContext.java:199)
          ...more stuff...


          What's going on here? I'd already be happy to know a way how I can work
          around this problem in my code, e.g. by a repeated lookup in case this
          exception occurs. Is there a way how I can get a valid InitialContext
          reference in my client despite this exception being thrown?

          Thanks,
          -- Axel

          ArcStyler - the IT-Architectural IDE for J2EE/EJB
          -> IBM Solution Excellence Award winner for Hot Java Solution
          -> European Information Society Technologies Prize Winner 2001
          -> free trial-version at http://www.ArcStyler.com
          ---- < iO > -----------------------------------------------------
          Interactive Objects Software GmbH
          mailto:axel.uhl@io-software.com
          http://www.io-software.com
          Basler Strasse 65, D-79100 Freiburg, Germany
          Tel: [+49]-761-40073-57, Fax: [+49]-761-40073-73
          • 2. Re: PeerGoneException upon repeated InitialContext construction
            666705
            We are currently seeing the same problem here...and I can assure you that we are definitely closing the context when we are through with it. Did you ever get a solution?

            We are running Weblogic 8.1 SP4 on a Solaris server.