Could you explain to us what you are trying to achieve.
There are other possibilities for managaing JNDI for different applications.
THANKS in advanced.
What I am trying to do is to deploy 2 webapps on one jboss. One webapp is actually the upgrade version of the other one. I want them to be installed into a same jboss server. These two webapps connect to their own separate databases. Since the jndi names are the same among these two versions, I want to use two different jndi context in order to allow each of them to call their own ejbs, just like in different servers, and with minimal modification on the code.