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
[Security:090398]Invalid Subject: principals=[weblogic, Administrators]
Here is my 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();
}
Can anyone tell what's wrong?