I have two JBoss Server on two PC connected with LAN. Two server have different EJBs (of course, different functions).
How can I call EJBs from one server to another server?
client -> JBoss Server A -> JBoss Server B
 (do sth then call (do sth then return
 EJBs in Server B. to Server A)
 Return the result
 of Server A & B)
For examples, UserHome is the Home of EJB in Server B. The following code is in the Server A call Server B EJB.
try {
 InitialContext ctx = new InitialContext();
 Object objref = ctx.lookup("ejb/fyp/main/UserBean");
 UserHome home = (UserHome)PortableRemoteObject.narrow(objref, UserHome.class);
} catch (Exception NamingException) {
 NamingException.printStackTrace();
}
As there hasn't UserHome class in server A, how can it connection to server B?
Is copy all the EJB class from Server A to Server B the only solution?