I have a web application running on the local server, accessing EJBs on a remote server. The local principal needed to access the web application is not the same as the remote user credentials. 1. Before invoking an ejb method from a delegate, I create the InitalContext with the required remote credentials and invoke the EJB. 2. After invocation I close the remote context explicitely so as to access my web application.
If I dont close the remote context, my web app stops working. If I close the remote context, I have to do a get InitialContext before each EJB method invocation and this can be expensive.
Can local and remote context co-exist? Is there some way by which I can avoid getting the initial context each time in the delegate? Would appreciate any help here.
posted 11 years ago
I think you can just change the environment before and after you call the remote server - without closing the context.