4 Replies Latest reply: Feb 22, 2012 4:03 PM by EJP RSS

    InitialContext problem in Application Client

    798692
      Hi Everyone,

      I was trying to create a application client project for an application which is running in the JBoss6 server. The following are the lines which i used to get the context of the application. But i could not.
      Properties properties = new Properties();  
      properties.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");  
      properties.put("java.naming.provider.url","http://localhost:1099");  
      properties.put("java.naming.factory.url.pkgs", "org.jboss.naming :-org.jnp.interfaces");  
      
      try {
           Context context = new InitialContext(properties); 
      } catch (NamingException e) {
           e.printStackTrace();
      }
      I am getting the following exception in the client console.
      log4j:WARN No appenders could be found for logger (org.jnp.interfaces.NamingContext).
      log4j:WARN Please initialize the log4j system properly.
      log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
      Exception in thread "main" javax.naming.CommunicationException: Could not obtain connection to any of these urls: http://localhost:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [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]]]
           at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1452)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:597)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:590)
           at javax.naming.InitialContext.lookup(InitialContext.java:409)
           at RoleLoader.main(RoleLoader.java:18)
      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]]
           at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:272)
           at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1423)
           ... 4 more
      Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server http:1099 [Root exception is java.net.UnknownHostException: http]
           at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:246)
           ... 5 more
      Caused by: java.net.UnknownHostException: http
           at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
           at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:867)
           at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1246)
           at java.net.InetAddress.getAllByName0(InetAddress.java:1197)
           at java.net.InetAddress.getAllByName(InetAddress.java:1128)
           at java.net.InetAddress.getAllByName(InetAddress.java:1064)
           at java.net.InetAddress.getByName(InetAddress.java:1014)
           at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:76)
           at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:242)
           ... 5 more
      I did followed most of the suggestions found in my querying. Can anyone guide me to get rid of this issue?

      Thanks
      Ram