Exception while connecting weblogic server using EJB - Invalid Subject: principals=[weblogic, Administrators]
<p>I have a thread running in my local weblogic server that runs once in a day which tries to establish connection with another application running in a different weblogic server. Whenever my method creates a remote object and tries to call remote method i get below exception<br></p>

<blockquote>
  <p><strong>[Security:090398]Invalid Subject: principals=[weblogic, Administrators]</strong></p>
</blockquote>

<p>Here is my code:</p>

<pre><code>    Properties myEnv = new Properties();
    myEnv.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    myEnv.put(Context.PROVIDER_URL, "t3//123.345.234.123:1234");
    myEnv.put( Context.SECURITY_PRINCIPAL, username );
    myEnv.put( Context.SECURITY_CREDENTIALS, password );        
    InitialContext context;
    Object lookupObj;
    try {
        context = new InitialContext(_contextEnv);  
        lookupObj = context.lookup("ejb.lookup.bean");
        MyHome home = (MyHome) PortableRemoteObject.narrow(lookupObj, MyHome.class);
        MyRemote remote =home.create();
        if (null != context) {
            try {
                context.close();
            }
            catch (Exception e) {
            //

            }
        }
        return remote;
    }  catch (Exception e) {            
        e.printStackTrace();
    }
</code></pre>

<p>Can anyone tell what's wrong?</p>