Domino Notes / Ldap connection Wls6.1

hi all,
is there a way to connect Wls 6.1 sp1 with Domino Notes 5 Ldap Server ?
Can we do an authentification login for groups and user?
If you did it can you reply me with a sample of connection parameters.
thanks
Hugues Simonnet
Consultant Principal
BEA Systems SA
Tel :+33(0)141457034
Fax: +33(0)141458408
Mob:+33(0)619023104
Tour Manhattan
6 place de l'Iris
F-92095 Paris la Défense 2 Cedex
http://www.bea.fr
http://www.bea.com

hi all,
is there a way to connect Wls 6.1 sp1 with Domino Notes 5 Ldap Server ?
Can we do an authentification login for groups and user?
If you did it can you reply me with a sample of connection parameters.
thanks
Hugues Simonnet
Consultant Principal
BEA Systems SA
Tel :+33(0)141457034
Fax: +33(0)141458408
Mob:+33(0)619023104
Tour Manhattan
6 place de l'Iris
F-92095 Paris la Défense 2 Cedex
http://www.bea.fr
http://www.bea.com

Similar Messages

  • LDAP connections not being closed

    Hi,
    I am trying to authenticate against a Netscape LDAP server and it works fine for 2 out of the 3 cases I am testing against.
    The first case is authenticating with the correct username and correct password. In this case the user is authenticated and the connection is closed.
    In the second case, I try to authenticate with the correct username and a wrong password. The authentication fails and an AuthenticationException is thrown. The connection is closed.
    In the third case, where I have the PROBLEM is if I provide a wrong username, AuthenticationException is thrown indicating that such an username does not exist. But the CONNECTION IS NOT CLOSED.
    Following is the code :
         private boolean authenticate(String userName, String password) throws Exception {
              Hashtable env = new Hashtable(11);
              env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
              env.put("com.sun.jndi.ldap.connect.pool", "false");
              env.put(Context.SECURITY_AUTHENTICATION, "simple");
              env.put(Context.SECURITY_PROTOCOL, "ssl");
              env.put(Context.SECURITY_PRINCIPAL, getSecurityPrincipal(userName));
              env.put(Context.SECURITY_CREDENTIALS, password);
              env.put(Context.PROVIDER_URL,"ldap://ldap05.nike.com:11003");
              DirContext ctx = null;
              try {
                   // Create initial context
                   ctx = new InitialDirContext(env);
                   return true;
              } catch (AuthenticationException e) {
                   log.error(e.getMessage());
              } catch (NamingException e) {
                   log.error("The user could not be validated on LDAP server due to :" + e.getMessage());
              } finally {
                   if (ctx != null) {
                        ctx.close();
              return false;
         }Any help is appreciated.
    Thanks in Advance.

    I did run the NETSTAT command and found some interesting things.
    I ran it for the three cases. The first case is running netstat immediately after authenticating the user with VALID credentials. The status of the connection is TIME_WAIT which is the desired behaviour.
    In the second case, when trying to authenticate with CORRECT username but a wrong password, an AuthenticationException is thrown. When I run the netstat command, the connection is in TIME_WAIT state which is the desired one.
    In the third case, when I provide a wrong username, an AuthenticationException is thrown. When I run the netstat command, the connection is in ESTABLISHED state, which it should not be in.
    An authenticationException is thrown for wrong username and also for wrong password. But the connection is closed for wrong password, but not for wrong username.This is what seems to me as a weird behaviour.
    I was under the impression that in the CODE I mentioned at the begining of this topic, the INITIALDIRCONTEXT had the responsibility of closing the connection when authentication fails as we don't have a handle to close it. It is doing so in the case of ERROR 49 which is wrong password, but not in the case of ERROR 32 which is wrong username. Correct me if I am wrong, but doesn't it seem to be a bug with the INITIALDIRCONTEXT class.
    Thanks.

  • LDAP Servers not listed when trying to setup new LDAP connection

    Using SQL Developer: 1.5.1
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0
    Windows XP client environment
    Can anyone clarify how to setup LDAP connections in SQL Developer. We use LDAP for our connections with all the other Oracle tools like SQL*Plus and other developer tools like forms. LDAP is working fine for all of those tools. However, when I try to setup an LDAP connection for SQL*Developer no servers are found for the drop down box. Do we need to put the sqlnet.ora and ldap.ora files somehwere so that SQL Developer can find them? Does SQL Developer even need them? How does the LDAP server get populated in SQL Developer? Thanks. I have tried looking at other posts on this issue and nothing really jumped out at how to do this. I do have some older version Oracle homes setup also. For example we have a Oracle 6i home setup on our machines for the old versions of forms and reports.

    I set it to C:\Oracle10g_DevSuiteHome_1\NETWORK\ADMIN. This is under one of my Oracle Homes on this machine that contains the sqlnet.ora and the LDAP.ora files. This didn't appear to make any difference. Still no LDAP servers listed when you try to add or build a new connection. I tried some of my other Oracle Homes and still no effect. I have also tried copying the sqlnet.or and the ldap.ora files to other directories. I have switched my default Oracle Home to point to the 9i and above homes and this made no difference.
    I have never had to do anything with an environment variable called TNS_ADMIN before. I almost remember a variable called TNS_ADMIN years ago in the registery that had to be modified and it was TNS_ADMIN if I remember correclty. When you said to set an environment variable you did mean to just set or create a new environment variable using the My Computer > Properties > Advanced Tab > Environment Variables on the client machine. I just want to make sure I set the right variable. Thanks for you help and suggestons.
    By the way I can connect just fine using basic or advanced connections. I just would like to use LDAP so I don't have to maintain connections when port, server or SID change. For example we just failed over and the fail over database is on a different server. We do this as a test or when needed for failover purposes. If you are using the basic and advanced connections you need to go in a update connection information. If we use LDAP this is all maintained by the DBAs and individual clients shouldn't have to maintain any connection information as long as the have the right SID. The documentation for SQL Developer doesn't really seem to address how to setup LDAP connections it just mentions that you can do it and it sounds simple.

  • Issue with LDAP Connection becuase of Network issue

    Hello All,
    We have some network issues going on which is causing the NIC (Network interface card) to failover to another NIC. Due to this failover SUN access manager's LDAP connection pool fills up and we see errors in logs "Directory is down". We have to restart the Access manager to resolve this issue which refresh the connection pool of LDAP.
    Now we have set the setting as recommended in admin guide/tuning guide. Like
    1. Set event connection idle timeout to less that firewall or loadbalancer idle timeout value.
    2. event connection retry count and interval on perticular error code.
    Despite of above settings its not working out. Is there other way to get all the stale connections back to the LDAP pool without restarting the server?
    Or something which handles the network failover or failback?
    Regards
    Chetan Kulshrestha

    The user search name is the value you should be looking at in the LDAP attributes, that's the one that it will send to LDAP on a logon attempt. If you changed this value after mapping a group, I'm not sure but you may have to remap the group to get the change.
    So on the LDAP side verify the user search attribute = the username you expect to login with (i.e. cn, samaccountname, uid, etc)
    Regards,
    Tim

  • NullPointerException at com.sun.jndi.ldap.Connection.run(Connection.java:52

    We are using the Sun jndi 1.2.1 files from a Java client to
    access the IBM SecureWay Directory 3.2 server. Our test case is
    retrieving entries using the ctx.getAttributes (String, String[])
    method. Occasionally we are receiving the following error.
    java.lang.NullPointerException
    at com.sun.jndi.ldap.Connection.run(Connection.java:525)
    at java.lang.Thread.run(Thread.java:481)
    The java.lang.NullPointerException is coming from the Sun JNDI file.
    Our program is not catching this exception.
    Has anyone seen this problem before and have any ideas on how this can be resolved?

    Download and use LDAP 1.2.3 or JDK 1.3.1.
    The problem should go away.

  • COBRA issue for Domino Notes

    Hi,ALL
    This is a strange Question, please help me to figure it out.
    I have a HttpServlet Aplication,
    It will connect with Domino server to search database as CLIENT.
    So, When It connect with Domino server.
    I use Notes Cobra connection:
    NotesFactory.createSession(....);
    unluckly, it thorws me exception:
    can't instantiate default ORB implementation lotus.priv.CORBA.iiop.ORB
    If I create a pure application runing on windows platform.and use the same function:
    NotesFactory.createSession(....);
    it works fine.
    why this problem happend if it is called under HttpServlet application?
    Thanks

    Follow-Up:
    Ironport, if you could get someone to investigate this, it would prevent future issues with your plugin.
    Thank you for the detailed report. I have filed defect #9107 for this issue. I'll also see that this gets added to our knowledge base.

  • 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

  • JNDIMapper Problem (Foreign JMS Providers with WebLogic Server does not close connection )

              Hello All,
              We tried to use wlsmqseries.zip classes (specially JNDI Mapper) for integrating
              WebLogic Server with MQ so that we can incorporate XA transactions. We use LDAP
              context factory to bind MQ.
              We found a number of LDAP connections are getting opened by JNDIMapper, but it's
              not getting closed.
              Can some one give some clue to this ?
              Also any suggestion to serve the current purpose is welcome.
              Thanks, Sudarson
              

              Hello All,
              We tried to use wlsmqseries.zip classes (specially JNDI Mapper) for integrating
              WebLogic Server with MQ so that we can incorporate XA transactions. We use LDAP
              context factory to bind MQ.
              We found a number of LDAP connections are getting opened by JNDIMapper, but it's
              not getting closed.
              Can some one give some clue to this ?
              Also any suggestion to serve the current purpose is welcome.
              Thanks, Sudarson
              

  • WLS 9.2.1 keeping huge no of opn Embedded LDAP connections

    Hello All,
    While using Embedded LDAP, we see a huge no of open LDAP connections through Admin console.
    We checked the following options:
    GroupMembershipSearching=limited
    MaxGroupMembershipSearchLevel=5
    But still the same issue persists.
    Any idea?
    /ed

    Are all these sockets actually listening or are they waiting to be closed? You can use netstat -a to find the status of these LDAP sockets.
    May be they are not being closed properly.

  • No LDAP connection available

    Hi,
    We are developing a Webcenter portal application using Webcenter 11g along with UCM 11g.
    We have integrated the Weblogic with external LDAP(i.e) we r not using the default LDAP comes with Weblogic
    We have also integrated the whole set up with OAM. We are using RIDC APi to check-in/update/fetch the content from UCM. We are facing following issue,
    1. We are able to login to UCM Admin console and check-in the content. But we are unable search and check-out the content via UCM Admin cosole . We are getting the below exception,
    Caused by: oracle.stellent.ridc.protocol.ServiceException: Unable to retrieve search results. Unable to execute service method 'getPreferredLanguage'. oracle.security.idm.IMException: oracle.ods.virtualization.service.VirtualizationException: oracle.ods.virtualization.engine.util.DirectoryException: LDAP Error 1 : No LDAP connection available to process request for DN: cn=orcladmin.. oracle.ods.virtualization.service.VirtualizationException: oracle.ods.virtualization.engine.util.DirectoryException: LDAP Error 1 : No LDAP connection available to process request for DN: cn=orcladmin.. oracle.ods.virtualization.engine.util.DirectoryException: LDAP Error 1 : No LDAP connection available to process request for DN: cn=orcladmin.. javax.naming.NamingException: No LDAP connection available to process request for DN: cn=orcladmin..
    2. Also we are getting the same exception when we try to check-in/update/fetch the content from the portal application via RIDC.
    Is there any config is missing or else as external LDAP is configured is there any configuration required at UCM end as well as in RIDC end
    Thanks in advance

    Hi ,
    I am getting the same exception.Have you got the solution for this.
    Regards;
    Vinay

  • LDAP Connection Pooling - JCA

    I'm interested in setting up connection pooling for LDAP. Our J2EE app is running on JBoss, and the database connections are already pooled through JCA using the provided JDBC resource adapter.
    So, I have investigated JCA a bit to see if that is the way to go to implement connection pooling for LDAP, but I haven't come to a conclusion yet. If I was to use JCA, it looks like I would need to create a resource adapter for LDAP, which does not seem to be a trivial task. Or is there already a resource adapter out there for the Sun Directory Server?
    For what I am trying to accomplish (connection pooling) is JCA overkill? If so, what would be the best course of action to take?
    Thanks,
    Jeff

    I guess you are talking about Context Pooling ...... The new version of JNDI ( not sure from when...) has
    context pooling in-built.... all you got to do is set the env property for pooling 'on'.....
    env.put("com.sun.jndi.ldap.connect.pool", "true");
    for further details
    http://java.sun.com/products/jndi/tutorial/ldap/connect/pool.html

  • Constant failed LDAP connections in log

    So a routine review of my log files (in pursuit of another problem) revealed yesterday that I'm getting this pair of messages about every 2 minutes:
    Dec 6 11:18:15 faulkner DirectoryService[763]: InitLDAPConnection or ldap_init failure: Logging Failed LDAP connection with incomplete data
    Dec 6 11:18:45 faulkner DirectoryService[763]: InitLDAPConnection or ldap_init failure: Logging Failed LDAP connection with incomplete da
    The machine -- a dual-G5 Xserve -- is configured for just standalone operation, so I'm not sure what the deal is here. I'm not seeing any login trouble, but it's disconcerting to have oddball log messages I don't understand.
    Any insight would be greatly appreciated.

    try this in /etc/pam.conf:
    passwd auth binding pam_passwd_auth.so.1 server_policy
    passwd auth required pam_ldap.so.1

  • LDAP connection timeout exception - some times

    Hi Team,
    I'm using Ldap authentication for my web applications. Everything is working fine most of the times.
    But ones in every 15 days or 10 days, I'm getting the connection timeout. But if I restart the tomcat then everything working fine. I couldn't find any
    issues with my code. Can anyone please help me on this. below is my java code. I'm keeping all the ldap entries in tomcat's server.xml and getting them in my java code to avoid the hard
    code configurations in my java code.
    I'm closing the context and naming enumerations like below, but still getting javax.naming.CommunicationException: error.
    Can anyone please help me out on this.
    public boolean authenticateFromLdap(String username, String password)throws AuthenticationException,Exception {
        LdapContext ctx = null;
        Context newctx = new InitialContext();
        Context envCtx = (Context) newctx.lookup("java:comp/env");
        DirContext ctxDir = (DirContext)envCtx.lookup("ldap/myapp");
        NamingEnumeration<?> namingEnum = null;
        String userDN=null;
        boolean isauthenticated = false;
        try {
            Hashtable env = null;
            Control[] connCtls = null;
            env = ctxDir.getEnvironment();
            env.put(Context.REFERRAL, "follow");
            this.filter = (String)env.get("ldap.filter");
            this.base = (String)env.get("ldap.base");
            try {
                ctx = new InitialLdapContext(env, connCtls);
                ctx.setRequestControls(null);
            } catch (javax.naming.AuthenticationException ex) {
                throw new Exception("ldap.server.exception");
            } catch (Exception ex) {
                throw new Exception("ldap.server.exception");
            try {
                SearchControls searchControls = new SearchControls();
                searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE);
                searchControls.setTimeLimit(30000);
                String filter="("+this.filter+"="+username+")";
                ctx.setRequestControls(null);
                namingEnum = ctx.search(this.base, filter, searchControls);
                SearchResult result = (SearchResult) namingEnum.next();
                Attributes attrs = result.getAttributes();
                Attribute str1=attrs.get("userprincipalname");
                userDN=str1.get().toString();
                if(userDN==null){
                    userDN=username;
                ctx.addToEnvironment(Context.SECURITY_PRINCIPAL,userDN);
                ctx.addToEnvironment(Context.SECURITY_CREDENTIALS,password);
                ctx.reconnect(connCtls);
                isauthenticated = true;
            }catch (AuthenticationException ex) {
                throw new AuthenticationException();
            }catch (NamingException ex) {
                throw new Exception("ldap.server.exception");
            return isauthenticated;
        } finally {
            if (null != namingEnum) {
                try {
                    namingEnum.close();
                } catch (Exception e) {
                    throw new Exception("close.ldap.failure");
            if (null != ctx) {
                try {
                    ctx.close();
                } catch (Exception e) {
                    throw new Exception("close.ldap.failure");
    }Tomcat (v6.0.14) server.xml:
                    <Resource name="ldap/myapp"
                                                    auth="Container"
                                                    type="com.sun.jndi.ldap.LdapCtx"
                                                    factory="com.myapp.MyLdapFactory"
                                                    java.naming.factory.initial="com.sun.jndi.ldap.LdapCtxFactory"
                                                    com.sun.jndi.ldap.connect.pool="false"
                                                    java.naming.provider.url="ldap://ldap.com.test.net:389"
                                                    java.naming.security.authentication="simple"
                                                    java.naming.security.principal="MyAdmin"
                                                    java.naming.security.credentials="xxxxxxx"
                                                    ldap.base="DC=com,DC=test,DC=net"
                                                    ldap.filter="sAMAccountName"
                    />Below is the error log trace:
    2013-Mar-26 12:01:34,714 AppUserDetailsService - javax.naming.CommunicationException: ldap.com.test.net:389 [Root exception is java.net.ConnectException: Connection timed out: connect]Note: Once we restart the tomcat, everything is working as usual and after 2 weeks again same problem occuring.
    Ganesh
    Edited by: EJP on 27/03/2013 14:26: added {noformat}{noformat} tags. Please use them. Your code is unreadable without them.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    1. 'filter' and 'base' need to be local variables, not instance variables, otherwise the method isn't thread-safe.
    2. It isn't clear that you are closing the search results or contexts if you get an exception, in all that spaghetti, especially the part where you just catch and rethrow exceptions, which is pointless. You need to rewrite that lot like this:
    public boolean authenticateFromLdap(String username, String password) throws AuthenticationException, NamingException
         Context newctx = new InitialContext();
         try
              Context envCtx = (Context)newctx.lookup("java:comp/env");
              try
                   DirContext ctxDir = (DirContext)envCtx.lookup("ldap/myapp");
                   try
                        String userDN = null;
                        boolean isauthenticated = false;
                        Control[] connCtls = null;
                        Hashtable env = ctxDir.getEnvironment();
                        env.put(Context.REFERRAL, "follow");
                        String     filter = (String)env.get("ldap.filter");
                        String     base = (String)env.get("ldap.base");
                        LdapContext ctx = new InitialLdapContext(env, connCtls);
                        try
                             ctx.setRequestControls(null);
                             SearchControls searchControls = new SearchControls();
                             searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE);
                             searchControls.setTimeLimit(30000);
                             filter = "(" + filter + "=" + username + ")";
                             ctx.setRequestControls(null);
                             NamingEnumeration<SearchResult> namingEnum = ctx.search(base, filter, searchControls);
                             try
                                  SearchResult result = namingEnum.next();
                                  Attributes attrs = result.getAttributes();
                                  Attribute str1 = attrs.get("userprincipalname");
                                  userDN = str1.get().toString();
                                  if (userDN == null)
                                       userDN = username;
                                  ctx.addToEnvironment(Context.SECURITY_PRINCIPAL, userDN);
                                  ctx.addToEnvironment(Context.SECURITY_CREDENTIALS, password);
                                  ctx.reconnect(connCtls);
                                  isauthenticated = true;
                                  return isauthenticated;
                             finally
                                  namingEnum.close();
                        finally
                             ctx.close();
                   finally
                        ctxDir.close();
              finally
                   envCtx.close();
         finally
              newctx.close();
    }Also, you are suppressing exceptions when you rethrow. Never do that. Always log the actual exception. But there aren't any exceptions here that need to be caught and rethrown.

  • Losing servlet-ldap connection

    Hi,
    The problem :
    I have a servlet that accesses an Ldap server (iplanet). The servlet loses the ldap connection after being unsused for a long while.
    What I tried :
    I implemented my own method (isConnected(), see the code below) to check the connection : this method performs a silly search in the Ldap. I call this method before any other call to the Ldap. When the connection is lost, the method hangs for a long while (more than 5 minutes) although I set the serverTimeLimit parameter to 10 seconds. The servlet is hanging during the call to the search method of the Ldap.
    The question :
    Do you know the ways to check if the ldap connection is still valid or not ?
    The details :
    Environment : Unix, Solaris 8
    Tomcat server 4.1
    Iplanet 5.1
    Ldap access : SDK
    The code :
    * isConnected()
    * Test the Ldap connection trying to perform a search request
    * @author mba
    * @version
    public boolean isConnected()
    boolean zb_IsConnected = true;
    // Test the connection with a request
    try
    String lDN = "ObjectName=*";
    String lFilter = "(ObjectName=*)";
    String lAttrs[] = {"ObjectID"};
    mLDAP.getSearchConstraints().setServerTimeLimit(10);
    LDAPSearchResults lResults = mLDAP.search (mSwitchDir, LDAPConnection.SCOPE_ONE, lFilter, lAttrs, false);
    catch (LDAPException e)
    if( (e.getLDAPResultCode() == LDAPException.SERVER_DOWN) ||
    (e.getLDAPResultCode() == LDAPException.CONNECT_ERROR) ||
    (e.getLDAPResultCode() == LDAPException.CONNECT_ERROR) ||
    (e.getLDAPResultCode() == LDAPException.TIME_LIMIT_EXCEEDED) ||           
    (e.getLDAPResultCode() != LDAPException.SUCCESS) )
    if(!reconnect())
    System.out.println("ldapMain::isConnected() - Error, failed to reconnect");          
              zb_IsConnected = false;
    return zb_IsConnected;
    }

    Hi All,
    I am working on a project which uses jsp and ldap. I am getting a very strange kind of error, sometimes for LDAP operation error called SERVER_DOWN(80) is coming it it goes if I refresh the page. behaviour of this error is very uncertain sometimes it comes and sometimes it does not come.
    Does anybody has any idea how to solve? is it something related to LDAP server settings or memory leaks. please guide
    thanks in advance
    -presi

  • EA3 - LDAP connection: context ?

    If one doesn't select a context on LDAP connection screen, when trying to connect the Status displays "Failed : -null" and nothing else happens.
    A more detailed error message would be appreciated.
    If I reopen the the connection screen, I can see the context information is not kept. As far as I'm concerned I have no idea what this context stands for.

    I'm not saying the context list doesn't get populated, but that if I don't select a value in it, I get a dumb message.
    I don't remember having to choose a context when using EA2, and have absolutely no idea what this context is. I just wish there would be a more explanatory message than "Failure - null" if I don't choose a context in the LOV.
    Actually once I've chosen the LDAP server, the LOV gets automatically populated, but no default value is applied, so if I don't choose a value I'll get a dumb "Failure - null" message if I try to connect.
    If I click on the LOV I can see it was populated, so I chose the first context (diasplaying cn=OracleContext) without knowing what it was and the connection worked.
    Once the connection is established, if I right-click the connection name in the connections list and choose properties, I see the context LOV doesn't display the context I chose the previous time, the LOV is still populated but the value I chose the first time does not appear anymore. This does not prevent future connections, it's just the information is not displayed again.

Maybe you are looking for

  • How do I wrap text around a picture in Pages 5.5?

    Using Yosemite, MacBook Pro (late 2009) Pages v. 5.5.  Previous version of Pages let me wrap text around pictures in newsletters.  I can't find this option or how-to anywhere in v. 5.5.  How do I wrap text around one side or another of an inserted pi

  • APC Value and Plan Value for an Asset.

    HI Gurus,                   I am developing a report where I have to display the APC value and Plan value of an Asset.Can anyone pls give an insight how to find this for the Asset.

  • MSS 60.1 Employee Documents iView problem

    Hi guys! I have implemented MSS BP ver. 60.1.19 and have problem with Employee Documents iView. It points on non-existing KM folder. However, if I would create it, it wouldn't help, because the portal creates user home folders in another path than th

  • Dynex DX-LCD32-09 HDMI ports / inputs not working

    My Dynex DX-LCD32-09 is just over a year old. It stopped recognizing anything plugged into the HDMI ports today. Not only that, every time the TV starts it goes to the TV input and displays the message "Please run channel auto scan" regardless of whi

  • Print GR slip using BAPI_GOODSMVT_CREATE

    Hi, My Output ype is configured but when i create GR via BAPI_GOODSMVT_CREATE (GOODSMVT_CODE = 03), the output is not determined. any help on it pls?