Problem:
Server IP = XXX.nnn.nn.nn
Client jndi.properties file:
jndi.CommandDispatcher=ejb/SessionBeanName
java.naming.provider.url=jnp://YYY.nnn.nn.nn:1099
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
Client uses server through NAT (Network Address Translation) and YYY.nnn.nn.nn is translated to
server real ip XXX.nnn.nn.nn. Error:
javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: XXX.nnn.nn.nn.
Solution that works with that client:
Server side:
- We added on the server side to run.sh file following directive: -Djava.rmi.server.hostname=server.company.com
Client side:
- We added swt-client to start with directive -Djava.rmi.server.hostname=server.company.com.
- We adeed one line to the workstations hosts file: YYY.nnn.nn.nn server.company.com
- we changed jndi.properties file: java.naming.provider.url=jnp://server.company.com:1099
After these changes it works ok with that client but not with other clients which are
connecting to server directly with real ip XXX.nnn.nn.nn.
Is there solution for both client types without using name-service ?