Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-1984

HttpNamingContextFactory unable to reconnect

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Major Major
    • No Release
    • JBossAS-3.2.7 Final
    • Naming
    • None

      Unlike the normal JNP/RMI Connection the HttpNamingContextFactory created Context does not recover from a application server shutdown. If I repeat lookups, the exception after the application server is available again looks like this:

      ex: javax.naming.CommunicationException: Could not obtain connection to any of these urls: http://127.0.0.1:8080/invoker/JNDIFactory [Root exception is javax.naming.CommunicationException: Failed to connect to server http:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server http:1099 [Root exception is java.net.UnknownHostException: http: http]]]
      javax.naming.CommunicationException: Could not obtain connection to any of these urls: http://127.0.0.1:8080/invoker/JNDIFactory [Root exception is javax.naming.CommunicationException: Failed to connect to server http:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server http:1099 [Root exception is java.net.UnknownHostException: http: http]]]
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1363)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:575)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:568)
      at net.eckenfels.JNDITest.main(JNDITest.java:72)
      Caused by: javax.naming.CommunicationException: Failed to connect to server http:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server http:1099 [Root exception is java.net.UnknownHostException: http: http]]
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:250)
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1348)
      ... 3 more
      Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server http:1099 [Root exception is java.net.UnknownHostException: http: http]
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:224)
      ... 4 more
      Caused by: java.net.UnknownHostException: http: http
      at java.net.InetAddress.getAllByName0(InetAddress.java:1128)
      at java.net.InetAddress.getAllByName0(InetAddress.java:1098)
      at java.net.InetAddress.getAllByName(InetAddress.java:1061)
      at java.net.InetAddress.getByName(InetAddress.java:958)
      at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:61)
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:220)
      ... 4 more

      Note the Unknown Host Exception, which looks pretty much like a destroyed or miss-parsed URL. Since the connection work with the same InitialContext instance before, the setup is correct:

      p.put("java.naming.factory.initial", "org.jboss.naming.HttpNamingContextFactory");
      p.put("java.naming.provider.url", "http://127.0.0.1:8080/invoker/JNDIFactory");
      p.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
      p.put("jnp.disableDiscovery", "true");
      Context rootCtx = (Context)new InitialContext(p);
      while(true)
      {
      try
      {
      // rootCtx = new InitialContext(p);
      Context jmxCtx = (Context)rootCtx.lookup("/jmx/rmi");
      l = jmxCtx.list("");
      while(l.hasMore())

      { System.out.println(" - " + l.next()); }

      } catch (Throwable t)

      { System.out.println("ex: " + t); t.printStackTrace(System.out); }

      try

      {Thread.sleep(10000);}

      catch(Throwable t) { }
      }

      This sample code works if i uncomment the re-creation of the InitialContext, however this is neighter needed by the JNP/RMI Version nor does the exception look like sane handling.

      The client is using jbossall-client.jar and jdk 1.5_04. Jboss 3.2.7 is running (unmodified default profile) on 1.5, too. Problem exists with 3.2.6, too.

            emuckenhuber_jira Emanuel Muckenhuber (Inactive)
            b.eckenfels Bernd Eckenfels (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: