I'm having the following problem:
I'm using a servlet to connect to a remote EJB,
The servlet can choose the server where the EJB is located, so I create an InitialContext setting its environment.
Then SessionEjb method is called and it performs some operation on DB.
And this works!
Problems arise because I've implemented a sort of failover: if the method of SessionBean fails on server A its catch clause il tries to do the same operation on server B, but on server B instantiating a new InitialContext and getting the interface from it.
I can access the method on server B from A but when I try to open the db connection I get and Invalid principal exception.
The strange thing is that if I access the same method fom the servlet I've no Exceptions.
The servlet is located for both cases on server C.
Could someone tell me why I have this problem ?
Thanks in advance,