geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From avin98 <avi...@yahoo.com>
Subject JNDI Lookup
Date Tue, 08 Aug 2006 19:20:42 GMT

Hi,

I have 2 Geronimo servers running on different boxes ...with the same
application resources.

I have a JMS Queue & a JMS Connection factory running on Box1 & Box2. 

>From Box 1, I try to connect to a JMS resource on Box 2, it fails.

Here is my code

public Queue getRequestQueue(String hostName) {
        
        if(hostName == null || hostName.length()==0)
            return getRequestQueue();
        
        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY,
"org.activemq.jndi.ActiveMQInitialContextFactory");
        env.put(Context.PROVIDER_URL, "tcp://server2:61616");
		 env.put(Context.SECURITY_PRINCIPAL,"geronimo");
			env.put(Context.SECURITY_CREDENTIALS,"geronimo");

		System.out.println("| .......................................... |");
		System.out.println("| The Hostname getRequestQueue for connection
is:"+hostName);
		System.out.println("| .......................................... |");
        
        try {
            InitialContext naming = new InitialContext(env);
            return (Queue) naming.lookup("Queue1");
        } catch(NamingException e){
            e.printStackTrace();
            return null;
        }
    }


I always get the Queue1 object which is bound to Server1 instead of getting
the object bound to Server2.

Is there anything i am doing wrong here ?

-- 
View this message in context: http://www.nabble.com/JNDI-Lookup-tf2074678.html#a5713223
Sent from the Apache Geronimo - Users forum at Nabble.com.


Mime
View raw message