You need to lookup the Session bean registered to appServer2's JNDI from appServer1. A simple way is to get an InitialNamingContext in appServer1, using appServer2 JNDI settings.
Another way would be to use HA-JNDI where you can have a unified naming space, thus looking up objects across servers.
thanks for your reply. this sounds good. now the second part of the problem is, i'd like to configure a set of properties (hostname, datadir) for the app2 dynamically so that i can deploy the app2 in dev, stage, prod just by running the same ant target (deploy). hence, i was thinking of an MBean whose mymbean-service.xml will contain dev, stage and prod values depending on the environment it is in.
i assume it's simple for the session bean in the app2 to have access to the values MBean configured.
can you see a better way of handling this? would i be better off using jbosscache at all?