Ok, let's say we have a context that doesn't timeout... we could do
as you say and get the dir context in the setContext method. But that
would mean that for every different user I want to use in my
application, there will be a different connection to LDAP. This lead us
to connection pooling.
If connections to LDAP timeout, is there any way to detect it? Or the
only way is caching an exception when trying to make an operation on
that connection? (I'm just guessing here, I don't know deeply JNDI and
the LDAP provider) If we have the later, that makes difficult to have a
connection pool, as we could serve connections that have timed out,
unless you have some tricky mechanism to refresh older connections in
your pool, as you suggest in your mail. Doing this could imply thread
usage unless we refresh connections under client requests, that could
cause what we are trying to avoid. And thread usage is forbidden in J2EE...
By the way, I'm using Active Directory, and it does time out... a
client requirement :(
What do you think?
Regards
Jose
Nicholas Whitehead wrote:
> Good point. It may, but that is an LDAP server
> configuration issue. I am using iPlanet Directory
> Server and contexts do not time out under the default
> configuration.
>
> However, if yours do time out for whatever reason, it
> will be slightly more challenging to keep a pool of
> contexts, since you will need to constantly refresh
> the contexts in the pool.
>
> //Nicholas
> --- Jose González Gómez <[EMAIL PROTECTED]>
> wrote:
>
>> Nicholas,
>>
>> Dosen't the context timeout??
>>
>> Regards
>> Jose
>>
>> Nicholas Whitehead wrote:
>>
>>> Try having your bean get the LDAP context in the
>>> setContext method. In that way, you will only have
>>
>> get
>>
>>> the context once per bean instance, which is
>>
>> better
>>
>>> than once per load.
>>>
>>> //Nicholas
>>> --- Jose González Gómez <[EMAIL PROTECTED]>
>>> wrote:
>>>
>>>> Hi there,
>>>>
>>>> I have an ejb named User that models an user
>>>> interacting with my
>>>> application. I need this as the actions this user
>>>> may do in the
>>>> application depend on his position in a directory
>>>
>> I
>>
>>>> access through LDAP.
>>>> I keep some info I need about the user in a
>>>> database, as this info is
>>>> not in the directory. This way the bean
>>>
>> encapsulates
>>
>>>> all the needed
>>>> access to LDAP and database.
>>>>
>>>> My problem is that in ejbLoad I need to
>>>
>> connect
>>
>>>> to LDAP and database,
>>>> and in ejbStore I connect only to the database,
>>>
>> as
>>
>>>> the info in LDAP will
>>>> never be changed in my application. I get the
>>>> connections to the
>>>> database from the connection pool of my app
>>>
>> server,
>>
>>>> but there's no
>>>> connection pooling for LDAP connnections, so the
>>>> ejbLoad operation takes
>>>> a lot of time in making this connection time
>>>
>> after
>>
>>>> time.
>>>>
>>>> What could I do? Should I make my own
>>>
>> connection
>>
>>>> pooling mechanism
>>>> for LDAP? Is this possible under J2EE? Any other
>>>> ideas about this?
>>>>
>>>> Thanks
>>>> Jose
>>>>
>>>>
> ===========================================================================
>
>>>> To unsubscribe, send email to
>>>
>> [EMAIL PROTECTED]
>>
>>>> and include in the body
>>>> of the message "signoff EJB-INTEREST". For
>>>
>> general
>>
>>>> help, send email to
>>>> [EMAIL PROTECTED] and include in the body of
>>>
>> the
>>
>>>> message "help".
>>>>
>>>
>>> =====
>>> Nicholas Whitehead
>>> Home: (973) 377 9335
>>> Cell: (973) 615 9646
>>> [EMAIL PROTECTED]
>>>
>>> __________________________________________________
>>> Get personalized email addresses from Yahoo! Mail
>>
>> - only $35
>>
>>> a year! http://personal.mail.yahoo.com/
>>>
>>>
> ===========================================================================
>
>>> To unsubscribe, send email to
>>
>> [EMAIL PROTECTED] and include in the body
>>
>>> of the message "signoff EJB-INTEREST". For
>>
>> general help, send email to
>>
>>> [EMAIL PROTECTED] and include in the body of
>>
>> the message "help".
>
>
>
> =====
> Nicholas Whitehead
> Home: (973) 377 9335
> Cell: (973) 615 9646
> [EMAIL PROTECTED]
>
> __________________________________________________
> Get personalized email addresses from Yahoo! Mail - only $35
> a year! http://personal.mail.yahoo.com/
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".