0

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?

JRad
  • 11
  • 6

2 Answers2

0

I think both weblogic server instances are running in 2 distinct domains. So, you need to enable a trust between the 2 domains. Have a look at this doc : https://docs.oracle.com/cd/E21764_01/web.1111/e13707/domain.htm#SECMG402

Also, don't forget to close the JNDI context in a finally clause when it is more more needed.

Emmanuel Collin
  • 2,556
  • 2
  • 10
  • 17
0

In my case,I just add parameters

-Dweblogic.security.crypto.verifyPriorDigest=true 
-Dweblogic.security.crypto.generatePriorDigest=true

to my JAVA_OPTIONS with Weblogic Server 12.2.1.4.0,for example,if you use nodeMangerService,you can edit your startNodeManager.sh and add the parameters.