tags:

views:

1148

answers:

2

I'm having a bit of a problem with getting JBoss working across networks. As a quick overview, we have a development network (which I'll call DEV), and a client network (say.. CLIENT!). These are connected via a firewall. In the Dev network, the server is known as 192.168.100.50, on the client network it's known as 10.0.100.50. DNS in both networks resolve the relevant IP by DNS (sqlserver.dev.net).

sqlserver provides 2 services, one via a .NET Web Service, the other by JBoss. When running the client on the DEV network, both services work fine. When on the CLIENT network, only the .NET service works.

The JBoss client throws an UnknownHostException when attempting to perform the ContextLookup in the following code:

Properties p = new Properties();
p.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
p.put("java.naming.factory.url.pkgs", "=org.jboss.naming:org.jboss.jnp.interfaces");
p.put("java.naming.provider.url", "sqlserver.dev.net:1199");

try {
  Context c = new InitialContext(p);
  cm = (ServiceRemote)c.lookup(Service.RemoteJNDIName);
} catch (NamingException e) {
  e.printStackTrace();
  throw new RuntimeException(e);
}

Exception is:

Root exception is java.rmi.UnknownHostException: Unknown host: SQLserver

I can confirm that the problem is that the client is attempting to connect to 'sqlserver' without a domain name. This has been tested by adding 'sqlserver' to the client's host file, and it works fine. Additionall, the spelling of 'SQLserver' is interesting, as this is how the Windows host reports it's hostname, not how it's stored in DNS. My best guess is that once the client makes the initial connection, JBoss tells the client to connect to 'SQLserver' in the future, which the client is unable to resolve.

I've already tried setting the following system properties to the FQDN of sqlserver:

jgroups.bind_addr
bind.address
java.rmi.server.hostname

Does anyone have any ideas?

+3  A: 

Ok, turns out that binding to 0.0.0.0 on startup actually messes up it's self-identification. Binding to sqlserver.dev.net (run.bat -b sqlserver.dev.net) fixed it.

Robert Wilson
A: 

May be your network having proxy server, you need to provide that proxy server ip and port of proxy in properties check for those.