I run a Session Bean (on Weblogic 7 or 8 server) inside wich, I need
to use the name of the Caller.
For this I use the following code :
private javax.ejb.SessionContext sessionContext;
public void setSessionContext(javax.ejb.SessionContext
sessionContext) throws javax.ejb.EJBException,
java.rmi.RemoteException {
this.sessionContext = sessionContext;

Here is the code to get the name of the caller :

It works fine when I use in my client application only 1

Here is the code in the client to construct the javax.naming.Context :
private static javax.naming.Context getInitialContext(String user,
String password) throws javax.naming.NamingException {
java.util.Properties p = new java.util.Properties();
p.put(javax.naming.Context.SECURITY_PRINCIPAL, user);
p.put(javax.naming.Context.SECURITY_CREDENTIALS, password);
return new javax.naming.InitialContext(p);

But when, from my client, I use 2 different javax.naming.Context
(constructed with different users (Context.SECURITY_PRINCIPAL)) to get
2 references to my Session Bean, I encounter unexpected results :
For the bean obtained with the User1, the method
sessionContext.getCallerPrincipal().getName() returns not always User1
(some times it returns User2). And it this the same with the bean
obtained with the User2.

Because the EJBContext is stored in an instance variable of my Session
Bean, I defined my bean as Stateful, but I encountered the same
May be, I do something wrong.

If anybody has an idea, it could help me.

Thanks for you help