Local 3.6.2 Server InitialContext OK -- Remote doesn't???
gberish Mar 17, 2005 9:17 PMI am trying to change a simple java JMS client.
It now sends Messeges to, and receives them from a Queue on my local server.
I want it to do the same from the same version server <3.6.2> that is running remotely on .org
But JNDI lookup is defeating me. Can anyone point me to a solution?
This code works fine:
Properties p = new Properties(); // get initial context p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); p.put(Context.PROVIDER_URL, "jnp://localhost:1099"); p.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces"); System.out.println ("Calling InitialContext"); ctx = new InitialContext(p); System.out.println ("InitialContext Found" + ctx); } // lookup connection factory factory = (QueueConnectionFactory)ctx.lookup("ConnectionFactory"); System.out.println ("Connection Factory instantiated"); // lookup destination destination = (Queue)ctx.lookup("queue/goIn"); System.out.println ("Destination instantiated"); ...But this fails with the error as shown on the screen print below.
Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.NamingContextFactory"); p.put(Context.PROVIDER_URL, "jnp://<myDomain>.org:1099"); p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces"); System.out.println ("Calling InitialContext"); ctx = new InitialContext(p); System.out.println ("InitialContext Found"); // lookup connection factory factory = (QueueConnectionFactory)ctx.lookup("ConnectionFactory"); System.out.println ("Connection Factory instantiated"); // lookup destination destination = (Queue)ctx.lookup("queue/goIn"); System.out.println ("Destination instantiated"); ...The print out of the failure is:
Calling InitialContext InitialContext Found Naming Exception javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is: java.net.ConnectException: Connection refused: connect] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:649) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:509) at javax.naming.InitialContext.lookup(InitialContext.java:351) at MessageTest.setUp1(MessageTest.java:78) at MessageTest.main(MessageTest.java:26) ... SetUp Done. Press any key to continue . . .[\code]