Determining the state of an LDAP connection

Hi all,
I'm in a situation where I need to determine the state of an existing LDAP connection. The code is called from Java servlets / JSP's, and we're having a problem where the client mysteriously disconnects. The stack trace points to:
04/10/04 10:24:54 javax.naming.CommunicationException: connection closed. Root exception is java.io.IOException: connection closed
04/10/04 10:24:54 at com.sun.jndi.ldap.LdapClient.ensureOpen(LdapClient.java:1648)
04/10/04 10:24:54 at com.sun.jndi.ldap.LdapClient.search(LdapClient.java:594)
04/10/04 10:24:54 at com.sun.jndi.ldap.LdapCtx.doSearch(LdapCtx.java:1921)
04/10/04 10:24:54 at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1783)
04/10/04 10:24:54 at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1708)
04/10/04 10:24:54 at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.java:368)
04/10/04 10:24:54 at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:328)
04/10/04 10:24:54 at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:313)
04/10/04 10:24:54 at javax.naming.directory.InitialDirContext.search(InitialDirContext.java:238)
04/10/04 10:24:54 at com.tekelec.corpdir.ad.ADHelper.getAvailableOrgUnits(ADHelper.java:582)
The peculiar thing is that the InitialDirContext DOES exist, and is not null. Since we can't poinpoint what is causing the disconnects, the next best thing is to to a test against the context to determine if it is still connected.
Looking at this stack trace, I can see a function: com.sun.jndi.ldap.LdapClient.ensureOpen(LdapClient.java:1648)
Googling the source, shows the following implementation:
private void ensureOpen() throws IOException {
     if (conn == null) {
     throw new IOException("connection closed");
However, this does no good, since the function is private, and the corresponding Connection object is not exposed through JNDI.
Does anyone have any ideas? For now, I'm going to just call a simple 'lookup(...)' to cause the exception to be thrown if the connection is dead.
TIA!
-Sean

I was getting this exception on relatively large searches (but not on smaller ones). I was also getting a java.lang.OutOfMemoryError just before it that wasn't part of the stack trace. The server was nowhere near running out of swap, and all the /etc/system parameters (solaris) were reasonable.
Then I found this page:
http://java.sun.com/docs/hotspot/PerformanceFAQ.html#171
and changed the way I'm calling the jvm this way:
/usr/local/j2sdk1.4.2_08/bin/java -Xms512m -Xmx512m <java class file>
This solved the problem for me. Something you may want to try, anyway.

Similar Messages

  • Which file is checked to determine the state of the database?

    Hi,
    can any body plz tell that Which file is checked to determine the state of the database.
    Is it control file?
    Thanx
    Ashutosh Khare

    Hi,
    you can check the status of instance in nomount(pfile) and you can check status of database in mount stauts(controlfile)look carefully below
    SQL> startup nomount
    ORACLE instance started.
    Total System Global Area 1258291200 bytes
    Fixed Size                  2077264 bytes
    Variable Size             872418736 bytes
    Database Buffers          369098752 bytes
    Redo Buffers               14696448 bytes
    SQL> select status from v$instance;
    STATUS
    STARTED
    SQL> select open_mode from v$database;
    select open_mode from v$database
    ERROR at line 1:
    ORA-01507: database not mounted
    SQL> alter database mount;
    Database altered.
    SQL> select status from v$instance;
    STATUS
    MOUNTED
    SQL> select open_mode from v$database;
    OPEN_MODE
    MOUNTED
    SQL>
    so it is
    you can check the status of instance in nomount(pfile) and you can check status of database in mount stauts(controlfile)

  • Unable to determine the adapter engine or sld connection error

    1. Check wether the SLD is up or not
    2. Note 764176 - Error in XI due to inconsistent SLD contents --> Follow this note.

    Aswin..
    Is that a question or answer or information to others?
    VJ

  • Is it possible to capture the state of a button outside of capturing events?

    I was wondering if there was a way in Flex to determine the state of a button (i.e. up, down, over, selected, etc..) besides capturing each individual events.  What I am asking is essentially to be able to access the "phase" private member variable of the Button class.  Please advise.

    Actually, nevermind, I was mistaken that the Button.phase parameter was private, it is actually of mx_internal type.  Thanks.

  • How to determine the maximum size of JFrame?

    I am using JDK1.2 to develop an application. I have
    a problem to handle the maximum size of of JFrame.
    If the user clicks the maximum icon or double-clicks
    the title bar from the JFrame, the JFrame becomes
    maximum. How can I determine the state of maximization? I need to bring different views if the
    JFrame is maximum or minimum. I knew JDK1.4 can
    handle this problem. Or using JNI, either. Does
    anyone know other ways to handle this?
    Thanks,
    Peter

    So that you won't have to wait forever:
    Sorry, pal, the only way is JNI. I researched this earlier for 1.2, but can't find it right now in the database. They finally added it to 1.4.
    Good luck.

  • Detecting the State of Caps Lock

    I have a rather interesting problem - to which so far there seems to be a surprising lack of information.
    I wish to determine the state of the CAPS LOCK key as well as the INSERT / OVERWRITE - and as I think these are pretty standard, there should be a platform independent way to test the state of these.
    I can find no clues however - any suggestions would be appreciated.

    Try using public boolean getLockingKeyState(int keyCode) which is in java.awt.Toolkit
    http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Toolkit.html#getLockingKeyState(int)

  • How to determine the error code, returned from LDAP server

    I use the next code for connect to LDAP server:
            try{
                ctx = new InitialLdapContext(env, null);
                 //if connection successfull ...
            } catch (NamingException){
                 //if error occured ...
            }Is it possible to determine the numeric error code, returned from server?

    I was just working on using openldap, binding to it and checking for expired passwords and locked accounts and it looks like that an AuthenticationException is thrown in these circumstances and the ctx is null so it is not possible process connection response controls. But you can look at operation attributes if you have password policy enabled and you are looking for these type of errors

  • Enterprise Manager is not able to connect to the database instance. The state of the components are listed below.

    Dear all,
    I have trouble to connect em console to database instance. My database is 11.2.0.3 and before this I did the patching from version 11.2.0.1, and now i cannot get fully functionality of em console.
    error is:
    Enterprise Manager is not able to connect to the database instance. The state of the components are listed below.
    It shows that agent is connected, database and listener is up.
    I did recreation, dropping and recreating with emca, but no success.
    Did anyone have similar problems with em console?
    Regards,

    You need to first of all, Connect to the Database as SYSDBA (because your were not connected), then start the database (because it is not started).
    If you already used the username and password in the command prompt and you are sure that the database is already stared, then you need to set the ORACLE_SID before you open SQLPlus. This is because if SQLPlus does not know the SID you are connecting to, it simply thinks it is not up or has no service hence the message "Connected to an idle instance".

  • 2013 Exchange, Can't connect to Exchange Management Shell. It cannot determine the content type of the HTTP response from the destination computer.

    The following error occurs.
             Welcome to the Exchange Management Shell!
    Full list of cmdlets: Get-Command
    Only Exchange cmdlets: Get-ExCommand
    Cmdlets that match a specific string: Help *<string>*
    Get general help: Help
    Get help for a cmdlet: Help <cmdlet name> or <cmdlet name> -?
    Show quick reference guide: QuickRef
    Exchange team blog: Get-ExBlog
    Show full output for a command: <command> | Format-List
    Tip of the day #0:
    Did you know that the Identity parameter is a "positional parameter"? That means you can use:
     Get-Mailbox "user" instead of: Get-Mailbox -Identity "user"
    It's a neat usability shortcut!
    VERBOSE: Connecting to mail1.dorothy.local.
    New-PSSession : [mail1.dorothy.local] Connecting to remote server mail1.dorothy.local failed with the following error
    message : The WinRM client cannot process the request. It cannot determine the content type of the HTTP response from
    the destination computer. The content type is absent or invalid. For more information, see the
    about_Remote_Troubleshooting Help topic.
    At line:1 char:1
    + New-PSSession -ConnectionURI "$connectionUri" -ConfigurationName Microsoft.Excha ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
       gTransportException
        + FullyQualifiedErrorId : -2144108297,PSSessionOpenFailed
    Exception calling "GetComputerSite" with "0" argument(s): "The Specified directory object cannot be found."
    At C:\Program Files\Microsoft\Exchange Server\V15\bin\ConnectFunctions.ps1:164 char:2
    +     $localSite=[System.DirectoryServices.ActiveDirectory.ActiveDirectorySite]::GetC ...
    +    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : ActiveDirectoryObjectNotFoundException
    Failed to connect to an Exchange server in the current site.
    Enter the server FQDN where you want to connect.: mail1.dorothy.local
    VERBOSE: Connecting to mail1.dorothy.local.
    New-PSSession : [mail1.dorothy.local] Connecting to remote server mail1.dorothy.local failed with the following error
    message : The WinRM client cannot process the request. It cannot determine the content type of the HTTP response from
    the destination computer. The content type is absent or invalid. For more information, see the
    about_Remote_Troubleshooting Help topic.
    At line:1 char:1
    + New-PSSession -ConnectionURI "$connectionUri" -ConfigurationName Microsoft.Excha ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
       gTransportException
        + FullyQualifiedErrorId : -2144108297,PSSessionOpenFailed
    Randy Cheek

    Good Morning,
    Log into the server with an account that has appropriate Exchange rights, not a local account.  
    Note: By default - Domain Admins don't have Exchange rights.
    Dame Luthas, ITILv3, MCSE Messaging 2013, MCSA, MCITP
    My Technical Blog: http://thelifestrategist.wordpress.com
    Discipline is the Difference between Goals and Accomplishments
    If this post is useful, please hit the green arrow on the left & if this is the answer hit "mark as answer"

  • How to determine the connection time?

    Hello!
    We have big troubles with our ConnectionPool. We have adapted most parts from the Book "Professional Java Server Programming" (Wrox Press).
    However, the connections are invalid (I/O Exceptions like "End of TNS Data Channel" or "Broken Pipe") after a while.
    The average up-time of our pool is approximately 24 hours.
    Now we want to drop renew the connections after a certain amount of time (let�s say 1 hour). To do this, we would need to determine the time when the connection has been established. How can this be done?
    I have looked into the DatabaseMetaData class, but did not find anything (at the first glance).
    PLEASE help me / us, the problem is really severe!
    Thanks in advance,
    Gregor Graf

    PLEASE help me / us, the problem is really severe!Where did you get the pool from? Is it your code? If so then are you sending a keep alive query - which would keep the connection active?
    If it isn't your code then are you explicitly returning the connections to the pool?
    Commercial pools don't typically drop connections. Some do which can be discovered by examining the configuration options for the pool that you have.
    If it is your code and you just want to add this, then you add a time value to each connection node. Each time a node is returned you set the time. You have a thread that runs and checks the time value, dropping any that are older than the value you want.

  • HT1212 What if the Iphone states it is disabled connect to I-tunes but you don't have a computer and the one you are using wants you to trust it but you can't because it doesn't give you the option on your phone because it is locked?

    What if the I-Phone states it is disabled connect to iTunes and when you don't have a computer available that is sync with phone, but are using a different computer. You can't trust the computer from your phone because it is locked.  How do I gain access.

    bubblesblom wrote:
    Okay, so my friends think it is funny to change the passcode on my iPhone.
    Maybe you should get new friends.
    I'm not sure that recovery mode works when you have to trust the computer, but did you try it?
    If you can't update or restore your iOS device - Apple Support
    If that won't work, perhaps you can use Find my iPhone from a computer in your iCloud.com account to erase the device.
    iCloud: Erase your device - Apple Support
    This has nothing to do with the Find my iPhone app being installed on the phone, but you do have to have Find my iPhone activated in the iCloud settings on the phone.

  • LDAP Connection exception: unable to retreive the specified realm(s).

    I am using Embedded OC4J and I have a web form based authentication (j_security _check) and configured my orion-application.xml to use LDAP connection in this way:
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <orion-application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-application-10_0.xsd">
    <jazn provider="LDAP" location="ldap://192.168.1.114:389"
    default-realm="cn" jaas-mode="doAsPrivileged"/>
    <jazn-loginconfig>
    <application>
    <name>ceads</name>
    <login-modules>
    <login-module>
    <class>oracle.security.jazn.login.module.LDAPLoginModule</class>
    <control-flag>required</control-flag>
    <options>
    <option>
    <name>oracle.security.jaas.ldap.connect.pool.prefsize</name>
    <value>10</value>
    </option>
    ....... other LDAp parameters ...
    When I try to log in, is always failed and I get this exception. I have no Idea what to do.
    javax.security.auth.login.LoginException: oracle.security.jazn.JAZNException: The system is unable to retreive the specified realm(s).
    at oracle.security.jazn.spi.ldap.LDAPRealmManager.searchRealms(LDAPRealmManager.java:1194)
    at oracle.security.jazn.spi.ldap.LDAPRealmManager.getRealm(LDAPRealmManager.java:238)
    at oracle.security.jazn.login.module.RealmLoginModule.getRealmFromUsername(RealmLoginModule.java:247)
    at oracle.security.jazn.login.module.RealmLoginModule.getRealm(RealmLoginModule.java:219)
    at oracle.security.jazn.login.module.RealmLoginModule.getRealmUser(RealmLoginModule.java:198)
    at oracle.security.jazn.login.module.RealmLoginModule.authenticate(RealmLoginModule.java:111)
    at oracle.security.jazn.login.module.RealmLoginModule.authenticate(RealmLoginModule.java:86)
    at oracle.security.jazn.login.module.AbstractLoginModule.login(AbstractLoginModule.java:265)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
    at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
    at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
    at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
    at oracle.security.jazn.oc4j.OC4JUtil.doJAASLogin(OC4JUtil.java:241)
    at oracle.security.jazn.oc4j.GenericUser$1.run(JAZNUserManager.java:818)
    at oracle.security.jazn.oc4j.OC4JUtil.doWithJAZNClsLdr(OC4JUtil.java:173)
    at oracle.security.jazn.oc4j.GenericUser.authenticate(JAZNUserManager.java:814)
    at oracle.security.jazn.oc4j.FilterUser.authenticate(JAZNUserManager.java:1143)
    at com.evermind.server.http.EvermindHttpServletRequest.checkAndSetRemoteUser(EvermindHttpServletRequest.java:3760)
    at com.evermind.server.http.EvermindHttpServletRequest.getUserPrincipalInternal(EvermindHttpServletRequest.java:3727)
    at com.evermind.server.http.HttpApplication.checkAuthenticationAndAuthorize(HttpApplication.java:6350)
    at com.evermind.server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:3030)
    at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:738)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
    at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
    at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
    at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234)
    at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:29)
    at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:879)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.IllegalStateException: LDAP properties not properly defined. Please check your JAZN configuration.
    at oracle.security.jazn.spi.ldap.LDAPContext.getDirContext(LDAPContext.java:476)
    at oracle.security.jazn.spi.ldap.LDAPContext.getDefaultDirContext(LDAPContext.java:246)
    at oracle.security.jazn.spi.ldap.LDAPContext.getOrclRootCtxDN(LDAPContext.java:187)
    at oracle.security.jazn.spi.ldap.LDAPContext.getSiteJAZNCtxDN(LDAPContext.java:222)
    at oracle.security.jazn.spi.ldap.LDAPRealmManager.searchRealms(LDAPRealmManager.java:1087)
    ... 37 more
    Edited by: user6112181 on 15-oct-2010 19:30
    Edited by: user6112181 on 15-oct-2010 19:31

    Hi,
    Can you access the URL using a browser? Does it work with the credentials used for the RunAs account?
    Strange error message though - are the account you are running the console with, present in the SCSM CMDB?
    Regards
    //Anders
    Anders Asp | Lumagate | www.lumagate.com | Sweden | My blog: www.scsm.se

  • Determining the "type" of a SQL statement

    I'm using the Oracle thin driver with my JDBC program.
    I want to be able to accept a String containing a SQL statement from the user and execute it. If it's a select statement then present the rows returned in a JTable, otherwise retrieve the return value for the command (eg INSERT, DELETE, etc).
    Is there any "readymade" method in JDBC or Oracle driver to determine the type of a SQL statement in this sense. Or do I have to parse it myself? (Imagine having to write code to strip comments out etc!)

    There is no "readymade" method. But an easy way to check will be to check the first 6 charchters of the string.
    You could use
    newString = SQL.substring(0, 5); to obtain the first 6 characters.
    if the characters are "select"
    //do select things
    else
    // do insert/delete whatever things

  • Im facing problem while trying to update my iphone 4 from version 4.3.1 to iOS 5. While processing the downloaded 774mb file, it comes with the statement that the network connection timed out. why???

    im facing problem while trying to update my iphone 4 from version 4.3.1 to iOS 5. While processing the downloaded 774mb file, it comes with the statement that the network connection timed out. why???

    i have been dealing with this same issue, tried to  turn off firewall and even turn of antivirud but still it gave me the same error.

  • When trying to check my emails its states it can not connect to the server

    when trying to check my emails its states it can not connect to the server

    Hi Tanya2707,
    If you are having issues checking your email from your iPhone, you may find the troubleshooting steps in the following article helpful:
    iOS: Troubleshooting Mail
    http://support.apple.com/kb/ts3899
    Regards,
    - Brenden

Maybe you are looking for

  • Issue in source system creation under sap node

    hi, i am facing a strage issue here while creating a sap source system.  i have two development systems - bd1 for bi development, rd1 for r/3 development. rfc is propely maintained between both of the systems. now im creating the source sytsem under

  • How to use broadband function of helix

    Hi. Bought a helix recently - 37024ka - and im wondering whether it really has wwan. Checked in lenovo website and it says that it has wwan. Will be frustrated if it has none, since its one of the reason I bought this one. Any advice on how to make i

  • Excessive Fan Noise in Mac Pro (Late 2008)

    Starting in October of 2009, at about one year of age, my Mac Pro started cycling through periods of excessive fan noise: the fan goes from quiet/inaudible to so loud that I cannot hear talking on the radio in the room. Re-set the PRAM. Re-set the SM

  • What happend to Safari search history in ios 7?

    The oval search bar is gone, and when you selected it you could see old searches.  With the new unified, you cant see your old searches.  Is it still here?

  • Legal person

    Hi Gurus, I wanted to know is there a standard SAP functionality that if there is change in legal person in infotype 0001 then a organisation reassignment action cannot be performed. If no, where can the settings be done, as I am not able to perform