This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
EJB in machine A can use JNDI to lookup the remote component or home interface for the EJB in machine B, creating it (if necessary), and then use the EJBObject to get the services from EJB in machine B.
What do you mean connect between EJB in one machine and EJB in other machine? Is it about a cluster? Or is it only 2 applications communication? If the 1st is true: you declare ejb-ref and than you perform the normal lookup (and is not important where exactly the container is running) If 2nd is true: your EJB wanting connection will need to do the same steps as a regular client.