On some Linux distributions, remote deployment may fail with an exception like: Code Block |
---|
Caused by: java.io.IOException: Can not get connection to server.
Problem establishing socket connection for InvokerLocator
[socket://host:32342/]
|
That is a known bug, documented in httphttps://communitydeveloper.jboss.org/wiki/WhydoIgetasocketconnectionerrorwhenusingremoteJBossASdocs/DOC-16380, and the solution presented on that document is to use a cron job as the root user to fix the file when it gets broken. First, create the correct version of /etc/hosts and save it somewhere, such as /etc/hosts.fixed , and populate it with the following contents (replace myhost with the hostname of your computer, as reported by the hostname command, and the correct IP assignment, as reported by ipconfig ): Code Block |
---|
| 127.0.0.1 myhost localhost localhost.localdomain
::1 myhost localhost6 localhost6.localdomain6
127.0.1.1 myhost
## (optional entry); update if assigned a new address from DHCP
192.168.1.5 myhost
## The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
|
Important: If possible, enter your hostname with both the "basic" hostname and the fully-qualified domain name. Next, create a script named /etc/restore-etc-hosts.sh to replace the /etc/hosts file if Network Manager breaks it: Code Block |
---|
title | /etc/restore-etc-hosts.sh |
---|
| #!/bin/sh
if [ `grep -c NetworkManager /etc/hosts` -eq 1 ]; then
cp /etc/hosts.fixed /etc/hosts
fi
|
Finally, setup a cron job to run this script as often as you like. We recommend every couple of minutes. Code Block |
---|
*/3 * * * * /etc/restore-etc-hosts.sh
|
Once the /etc/hosts file is corrected, restart JBoss AS and run the tests again. Your socket connection error should be gone! |