Hello folks,
I'm unable to lookup a EJB in a remote (swing) client. It seems that the NamingContext insists in using the local address (127.0.0.1) for lookups, despite the value of the java.naming.provider.url property. Here's what I'm doing:
[pre]Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
props.put(Context.PROVIDER_URL, "jnp://10.72.2.32:1099");
context = new InitialContext(props);
// name and clazz are defined elsewhere
return PortableRemoteObject.narrow(context.lookup(name), clazz);[/pre]
However, this code fails with the following exception:
[pre]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 sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:101)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:469)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:448)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at com.telebahiacelular.movistore.client.RemoteUtils.lookup(RemoteUtils.java:32)
...[/pre]
What could be wrong? Why it's using 127.0.0.1 even when I've set the provider URL to a different address? By the way, this used to work fine when I run JBoss on the same machine. Now that I (finally) moved JBoss out of my development machine, I can't connect anymore.