Hi,
I am trying to connect from a stand alone program to a 2 nodes cluster started on binding set ports-02 and ports-03, all the start and node discovery seams to be ok, but the JNDI lookup fails.
here is the client code:
Connection connection = null; InitialContext initialContext = null; Hashtable<String, String> jndiParameters = new Hashtable<String, String>(); jndiParameters.put("java.naming.provider.url", "127.0.0.1:1102,127.0.0.1:1103"); jndiParameters.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); jndiParameters.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); initialContext = new InitialContext(jndiParameters); ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");
Exception in thread "Main Thread" javax.naming.CommunicationException: Could not obtain connection to any of these urls: 127.0.0.1:1102,127.0.0.1:1103 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 /127.0.0.1:1103 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server /127.0.0.1:1103 [Root exception is java.net.ConnectException: Connection refused: connect]]] at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1763) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:693) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686) at javax.naming.InitialContext.lookup(InitialContext.java:392) at HAJNDISample.main(HAJNDISample.java:32)
One more thing also seams strange: the fact that I can connect and lookup to Naming service port, specified in service=Naming but it doesn't supports fail over.