Enable client to connect to server by IP, not host name
-------------------------------------------------------
Key: EJBTHREE-1935
URL:
https://jira.jboss.org/jira/browse/EJBTHREE-1935
Project: EJB 3.0
Issue Type: Feature Request
Environment: JBoss 4.2.3
Reporter: Vasya Vasilchikov
When a client lookups an EJB on the server for the first time, InitialContext is
initialized and the client receives NamingServer_Stub. The stub contains server host name,
not IP address, although the client called server with IP. If client machine fails to
resolve the host name, subsequent calls for NamingServer_Stub fail.
In Jboss 4.0.4GA the stub contained IP address.
Please allow to configure IP-based stubs in Jboss 4.2.x also.
Client code:
jndiProp.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.jboss.security.jndi.JndiLoginInitialContextFactory");
jndiProp.setProperty(Context.PROVIDER_URL, "172.17.0.6:1099");
Context context = null;
try {
context = new InitialContext(jndiProp);
NMSDBManager manager =
(NMSDBManager)context.lookup("NMSDBManagerBean/remote");
return manager;
} catch (Throwable t)
{
t.printStackTrace();
}
Exception:
javax.naming.CommunicationException [Root exception is java.rmi.UnknownHostException:
Unknown host: NMS-74; nested exception is:
java.net.UnknownHostException: NMS-74]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:780)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.ethos.appserver.client.ServerLogin.getServerManager(ServerLogin.java:43)
at
com.ethos.gui.nms.view.dialog.LoginEthosNMSDialog.connectoToServer(LoginEthosNMSDialog.java:370)
at
com.ethos.gui.nms.view.dialog.LoginEthosNMSDialog.access$2(LoginEthosNMSDialog.java:355)
at
com.ethos.gui.nms.view.dialog.LoginEthosNMSDialog$1.construct(LoginEthosNMSDialog.java:390)
at com.ethos.gui.infra.worker.SwingWorker$1.call(SwingWorker.java:63)
at com.ethos.gui.infra.worker.FutureResult$1.run(FutureResult.java:81)
at com.ethos.gui.infra.worker.SwingWorker.run(SwingWorker.java:79)
at java.lang.Thread.run(Unknown Source)
Caused by: java.rmi.UnknownHostException: Unknown host: NMS-74; nested exception is:
java.net.UnknownHostException: NMS-74
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
... 10 more
Caused by: java.net.UnknownHostException: NMS-74
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
... 16 more
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira