0 Replies Latest reply on Jan 2, 2014 5:33 AM by Ravi Ananda

    Jboss 7.1 connection time out for ejb lookup using the client

    Ravi Ananda Newbie

      Hi,

       

      I have created simple ejb3 and deployed on jboss 7.1 server.

      When I am trying to lookup using the client code, I am getting the below exception.

       

      public class ClientUtility {  
      /*location of JBoss JNDI Service provider the client will use.    It should be URL string.*/ 
      private static final String PROVIDER_URL = "remote://localhost:4447";  
      /*specifying the list of package prefixes to use when    loading in URL context factories. colon separated*/ 
      private static final String JNP_INTERFACES = "org.jboss.naming:org.jnp.interfaces"; 
      /*Factory that creates initial context objects.    fully qualified class name. */
      private static final String INITIAL_CONTEXT_FACTORY = "org.jnp.interfaces.NamingContextFactory";
      private static Context initialContext;    

      public static Context getInitialContext() throws NamingException    {  
        if (initialContext == null) {         
         //Properties extends HashTable          
         Properties prop = new Properties();      
         prop.put(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY);    
         prop.put(Context.URL_PKG_PREFIXES, JNP_INTERFACES);        
         prop.put(Context.PROVIDER_URL, PROVIDER_URL); 
         //prop.put(Context.PROVIDER_URL, "remote://localhost:4447");
         prop.put(Context.SECURITY_PRINCIPAL, "admin");
         prop.put(Context.SECURITY_CREDENTIALS, "fifa@1234");

         initialContext = new InitialContext(prop);     
         }      
        return initialContext;   
        }
      }

       

       

      javax.naming.CommunicationException: Could not obtain connection to any of these urls: remote://localhost:4447 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 remote:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server remote:1099 [Root exception is java.net.ConnectException: Connection timed out: connect]]]

      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1399)

      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:579)

      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)

      at javax.naming.InitialContext.lookup(Unknown Source)

      at com.client.EJBApplicationClient.doLookup(EJBApplicationClient.java:22)

      at com.client.EJBApplicationClient.main(EJBApplicationClient.java:11)

      Caused by: javax.naming.CommunicationException: Failed to connect to server remote:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server remote:1099 [Root exception is java.net.ConnectException: Connection timed out: connect]]

      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:254)

      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1370)

      ... 5 more

      Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server remote:1099 [Root exception is java.net.ConnectException: Connection timed out: connect]

      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:228)

      ... 6 more

      Caused by: java.net.ConnectException: Connection timed out: connect

      at java.net.PlainSocketImpl.socketConnect(Native Method)

      at java.net.PlainSocketImpl.doConnect(Unknown Source)

      at java.net.PlainSocketImpl.connectToAddress(Unknown Source)

      at java.net.PlainSocketImpl.connect(Unknown Source)

      at java.net.SocksSocketImpl.connect(Unknown Source)

      at java.net.Socket.connect(Unknown Source)

      at java.net.Socket.connect(Unknown Source)

      at java.net.Socket.<init>(Unknown Source)

      at java.net.Socket.<init>(Unknown Source)

      at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:69)

      at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:62)

      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:224)

      ... 6 more

      Exception in thread "main" java.lang.NullPointerException

      at com.client.EJBApplicationClient.main(EJBApplicationClient.java:13)