I've got the same beans deployed on two different app servers (each
backed by a different database). I want my client to talk to both.
Say the two app servers are running on machines named Fred and Wilma;

I know I can choose which one I talk to by setting

  java.naming.provider.url=ormi://fred/app

or

  java.naming.provider.url=ormi://wilma/app

But how do I switch at run time? I don't want to keep changing the
system property every time I get an InitialContext(), because the
system property is a global setting and one piece of code might not
know what another piece of code is doing. Is there a way to specify
the JNDI url when you create an InitialContext?




Reply via email to