I am going through a book example, and it tells me to type
in order to run my client that will access an EJB running on JBoss on my the local machine. It works fine, but I was wondering what would I need to change if I was to run this client on a remote machine? How do I tell it where the remote host is? The address in the above command points to JBosses naming provider, I doubt it would be enough to change just that... [ December 01, 2008: Message edited by: Bojan Tomic ]
I'm not sure why this worked and need to investigate the implications, but at least I have a solution to be working with.
When JBoss AS starts up, it binds to localhost by default. Older versions of JBoss would bind to the address 0.0.0.0. Because of this change, you can’t access JBoss AS locally by using your machine name or 0.0.0.0. For example, to verify the server is running, you can’t go to http://myhostname:8080; you have to go to http://localhost:8080 or http://127.0.0.1:8080.
Side note: If you are reading JBoss in Action (which is being featured in the forums this week), see chapter 15 for further discussion on binding.
Up to JBoss 4.2 the server (HTTP and all services) bound to 0.0.0.0, meaning to all interfaces on the system. Since too many people have not secured internet facing systems this behaviour has been changed since JBoss 4.2.0. JBoss now only binds to 127.0.0.1 by default. You can use the -b parameter with run.sh/run.bat to either bind to the desired IP or 0.0.0.0 if you want the pre 4.2 behaviour back. Make sure you went through the security guideline point by point since there are at least 5+ ways an unsecured JBoss server can be taken over.
If bound to 0.0.0.0 clients will receive the hostname to connect to RMI. In this case you can set 'java.rmi.server.hostname=' to send an IP or different hostname to the client.
My problem is that machine name of the server I am running JBoss is not in the DNS. So when my Java client connects to JBoss to do the JNI lookup, JBoss is returning a system name that my client cannot get resolved. I tried adding -Djava.rmi.server.hostname=xxx.xx.xxx.xx as suggested, but now I get a different error:
10:30:24,977,FATAL,[UnifiedInvokerProxy] Could not initialize UnifiedInvokerProxy.
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Yes, thanks, the clientConnectAddress entry in remoting-jboss-beans.xml worked for JE22 clients that use the MicroSocketClientInvoker. The
-Dremoting.bind_by_host=false worked for EJB3 clients which use the ProxyObjectFactory. Haven't tried the fix for JMS yet. Somewhat annoying that you have to make multiple changes to get remoting to behave consistently.
Without deviation from the norm, progress is not possible - Zappa. Tiny ad: