[jboss-user] [JNDI and Naming] - HA JNDI , failed to connect from stand alone

roman.mandeleil@gmail.com do-not-reply at jboss.com
Tue Sep 29 08:27:57 EDT 2009


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");



I get the following: 


  | 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)
  | 
        

Very strange,  I have checked the MBean configurations in JMX and it seams to be correct.

Thanks in advance
Roman






View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4257635#4257635

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4257635



More information about the jboss-user mailing list