I have EJB A and B. A references B. Initially, these 2 EJBs are packaged in a ejb-jar and deployed in the local server. A always uses ejb's local naming context to lookup B. It is easy to setup jboss.xml that maps B to a global jndi-name in the local server.
Now, EJB B is deployed to a remote server. I know I can create an InitialContext and specify remote server (PROVIDER_URL) explicitly so that EJB A can lookup from the remote server. However, I don't want to change any coding. What I am interested in is an easy way to configure lookup of EJB B without changing the lookup code in EJB A.
In the <ejb-ref> in jboss.xml
This is not recommended for two reasons.
1) It is slow
2) JBoss does not include a distributed transaction manager (DTM)
which you will need to run both ejbs in the same transaction context.