I had this problem, & just now I solved it:
My OS is RedHat 7.1 and I didn't configurate my HOSTNAME and hosts.
Initialy I had on hosts file:
172.0.0.1 servername localhost mylocalhost
then I change it to
172.0.0.1 localhost mylocalhost
xxx.xxx.xxx.xxx servername myservername
(xxx.xxx.xxx.xxx are the IP of server machine where I have installed JBoss and refered on jndi.properties of the client)
and then set the hostname to servername using:
/bin/hostname myservername
try watch the enviroment variable HOSTNAME (echo $HOSTNAME) if it still is LOCALHOST change to myservername (export LOCALHOST=myservername)
and try to connect the cliente