// this is to access data source in appserver 1
Hashtable htblProps1 = System.getProperties();
InitialContext ic = new InitialContext(htblProps1 );
DataSource ds = (DataSource)ic.lookup("jdbc.eaDS1");
// now on access appserver2 for a ejb by providing the security
credentials
Hashtable htblProps2 = System.getProperties();
htblProps2.put(Context.INITIAL_CONTEXT_FACTORY, MY_IC_FACTORY);
htblProps2.put(Context.PROVIDER_URL, MY_URL);
htblProps2.put(Context.SECURITY_PRINCIPAL,"guest");
htblProps2.put(Context.SECURITY_CREDENTIALS,"guest");
InitialContext ic1 = new InitialContext(htblProps2 );
com.xxx.IHome iaccountHome =
(com.xxx.IHome)ic1.lookup("ejb/MyBean");
// Now come back and lookup the same resource as step one in the
appserver1 using a new initial context
Hashtable htblProps3 = System.getProperties();
InitialContext ic3 = new InitialContext(htblProps3 );
DataSource ds = (DataSource)ic3.lookup("jdbc.eaDS1");
DataSource ds2 = (DataSource)ic3.lookup("jdbc.eaProcess");
at this point the lookup throws the followin error (if i use the same
sequence of code inside webcomponent in appserver1 it works), this part only
fails for a client running on command line !!. If i remove the following two
lines (from step 2) it fails inside the webcomponent and run correctly in
command line ....(then it complains about authenticating the system account,
although i didn't provide any..)
htblProps2.put(Context.SECURITY_PRINCIPAL,"guest");
htblProps2.put(Context.SECURITY_CREDENTIALS,"guest");
java.lang.SecurityException: Authentication for user guest denied in realm
wl_realm
Start server side stack trace:
java.lang.SecurityException: Authentication for user guest denied in realm
wl_realm
at weblogic.security.acl.Realm.authenticate(Realm.java:212)
at weblogic.security.acl.Realm.getAuthenticatedName(Realm.java:233)
at
weblogic.security.acl.internal.Security.authenticate(Security.java:125)
at weblogic.security.acl.internal.Security.verify(Security.java:87)
at
weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:235)
at
weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:2
2)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
End server side stack trace
at
weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.
java:85)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
:255)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
:222)
at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:35)
at $Proxy0.lookup(Unknown Source)
at
weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:323)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at com.edocs.eaprocess.common.JNDIUtil.main(JNDIUtil.java:97)
Thank You,
Saman
<snip>
> java.lang.SecurityException: Authentication for user guest denied in realm
> wl_realm
>
I came across this problem a few weeks ago, albeit running two
Weblogic 5.1 sp 10 servers. It turned out that the problem was that
the two servers had different system passwords, and setting them to be
the same resolved this.
regards
Mark