JNDI Contexts and Threads
When you create a JNDI Context with a username and password, you
associate a user with a thread. When the Context is created, the user is
pushed onto the context stack associated with the thread. Before
starting a new Context on the thread, you must close the first Context
so that the first user is no longer associated with the thread.
Otherwise, users are pushed down in the stack each time a new context
created. This is not an efficient use of resources and may result in the incorrect user being returned by
ctx.lookup()
calls. This scenario is illustrated by the following steps:
- Create a Context (with username and credential) called
ctx1
foruser1
. In the process of creating the context,user1
is associated with the thread and pushed onto the stack associated with the thread. The current user is nowuser1
. - Create a second Context (with username and credential) called
ctx2
foruser2
. At this point, the thread has a stack of users associated with it.User2
is at the top of the stack anduser1
is below it in the stack, souser2
is used is the current user. - If you do a
ctx1.lookup("abc")
call,user2
is used as the identity rather thanuser1
, becauseuser2
is at the top of the stack. To get the expected result, which is to havectx1.lookup("abc")
call performed asuser1
, you need to do actx2.close()
call. Thectx2.close()
call removesuser2
from the stack associated with the thread and so that actx1.lookup("abc")
call now usesuser1
as expected.
Note: | When the weblogic.jndi.enableDefaultUser flag is enabled, there are two situations where a close()
call does not remove the current user from the stack and this can cause
JNDI context problems. For information on how to avoid JNDI context
problems, see How to Avoid Potential JNDI Context Problems. |
How to Avoid Potential JNDI Context Problems
Issuing a
close()
call is usually as described in JNDI Contexts and Threads.
However, the following is an exception to the expected behavior that
occur when the weblogic.jndi.enableDefaultUser flag is enabled:
Last Used
When using IIOP, an exception to expected behavior arises when there is
one Context on the stack and that Context is removed by a
close()
.
The identity of the last context removed from the stack determines the
current identity of the user. This scenario is described in the
following steps:
- Create a Context (with username and credential) called
ctx1
foruser1
. In the process of creating the context,user1
is associated with the thread and stored in the stack, that is, the current identity is set touser1
. - Do a
ctx1.close()
call. - Do a
ctx1.lookup()
call. The current identity is user1. - Create a Context (with username and credential) called
ctx2
foruser2
. In the process of creating the context,user2
is associated with the thread and stored in the stack, that is, the current identity is set touser2
. - Do a
ctx2.close()
call. - Do a
ctx2.lookup()
call. The current identity is user2.
Link to the source Weblogic Docs: Weblogic JNDI
This comment has been removed by a blog administrator.
ReplyDeleteFrpfile All In One Tool AIO V2.4 Free Tool iCloud Bypass 13 & 14.7 iCloud bypass FRPFILE is a small Windows Application Used to Bypass iCloud Lock with One Click After Jailbreak. for jailbreak, you have to use mac method you can find on my website.
ReplyDeleteMua vé máy bay tại Aivivu, tham khảo
ReplyDeletevé máy bay đi Mỹ Vietnam Airline
gia ve tu my ve vietnam
vé máy bay khứ hồi từ đức về việt nam
vé máy bay từ nga về việt nam
giá vé máy bay từ anh về việt nam
chuyến bay từ pháp về việt nam hôm nay>
chuyen bay chuyen gia trung quoc