I tried to lookup an EJB (running in jboss) on a remote box. My code is a stateless session bean running in jboss on localhost. I accidentally used a wrong port for looking up the remote EJB and got java.net.ConnectException, ServiceUnavailableException, etc. I expect that I would get a java.rmi.RemoteException for this type of situation. Did I do something wrong or this is a jboss bug?