Java JNDI LDAP connectivity problem.  NoSuchAttributeException

Hello,
I am trying to add a user to Active Directory server through LDAP. Following is the code I am using:
======================================================================
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://192.123.321.123:389");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "user1");
env.put(Context.SECURITY_CREDENTIALS, "user123");
try {
System.out.println("68");
Context ctx = new InitialContext(env);
System.out.println("71");
BasicAttribute oc = new BasicAttribute("objectclass", "top");
oc.add("person");
oc.add("organizationalperson");
oc.add("User");
BasicAttribute ouSet = new BasicAttribute("ou");
ouSet.add("test");
BasicAttributes attrs = new BasicAttributes(true);
attrs.put(oc);
attrs.put(ouSet);
attrs.put("cn", "ndubey001");
attrs.put("sn", "ndubey001");
attrs.put("sAMAccountName", "ndubey001");
attrs.put("givenName", "ndubey001");
attrs.put("name", "ndubey001");
ctx.bind("uid=ndubey001,ou=test,o=myserver.com", attrs);
System.out.println("74");
ctx.close();
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
======================================================================
I have tried with so many different combinations. Most of the times the parameters I am passing looks okay but I keep getting the same exception as follows:
======================================================================
68
71
javax.naming.directory.NoSuchAttributeException: [LDAP: error code 16 - 00000057: LdapErr: DSID-0C090B38, comment: Error in attribute conversion operation, data 0, vece
at com.sun.jndi.ldap.LdapCtx.mapErrorCode(Unknown Source)
     at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
     at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
     at com.sun.jndi.ldap.LdapCtx.c_bind(Unknown Source)
     at com.sun.jndi.ldap.LdapCtx.c_bind(Unknown Source)
     at com.sun.jndi.toolkit.ctx.ComponentContext.p_bind(Unknown Source)
     at com.sun.jndi.toolkit.ctx.PartialCompositeContext.bind(Unknown Source)
     at com.sun.jndi.toolkit.ctx.PartialCompositeContext.bind(Unknown Source)
     at javax.naming.InitialContext.bind(Unknown Source)
     at LDAPTest.main(LDAPTest.java:99)Coming out
======================================================================
Can anyone tell what is the exact problem ?
Cheers,
Nitin                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Too many errors to even consider correcting your code (objectClasses, UID attribute, ctx.create)....
Refer to the following for a description & sample code:
JNDI, Active Directory (Creating new users & demystifying userAccountControl
http://forum.java.sun.com/thread.jspa?threadID=582103&tstart=15

Similar Messages

  • 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.

  • LDAP connection problem

    I'm trying to connect to a server using Ldap in Java, but the connection dosent work. I did try to connect to my computer just for a test, my machine is on a network that use the server. Is it possible to connect to it using Ldap like this :
    env.put(Context,INITIAL_CONTEXT_FACTORY,
    "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(context.PROVIDER_URL, "ldap://" + NameOfMachine + "/");
    dirContext ctx = new InitialContext(env);
    I did put the classpath of the zip files (Jndi and Ldap). Is there something else i should do ?

    You might have to specify the port number also
    something like this
    env.put(context.PROVIDER_URL, "ldap://" + NameOfMachine:389+ "/");

  • LDAP Connectivity problem

    Hi ,
    I installed iplanet 6 with sp06 and DS 5.2 both have been installed suceesfull . But when i try to connect the Webserver settings (Global Settings) for the connectivity with the ldap directory server[b] it asks for
    Bind DN and Bind Password . I tried giving dc=...... and password as used in my ldap servers . But it shows kinldy check ur binddn and password ! unabel to connect.can anyone help me out with this .

    Too many errors to even consider correcting your code (objectClasses, UID attribute, ctx.create)....
    Refer to the following for a description & sample code:
    JNDI, Active Directory (Creating new users & demystifying userAccountControl
    http://forum.java.sun.com/thread.jspa?threadID=582103&tstart=15

  • LDAP connections problem

    Hi,
    I have configured my application to authenticate the user log in against my current LDAP system.
    However, i need to read into the app certain data held in the records of the LDAP system ( email address, ext. that sort of thing ).
    How would i go about doing this to display the details of the user currently selected or logged in. Also, is there a way of showin a list in my application of all the user names held in LDAP?
    Many Thanks
    Robert

    Hi Jes,
    The system i am building has to pull data from the LDAP for display on screen. Also, we not just authenticating the u/name and password - we also need to check if they have permission to use the system.
    If you know how to read parts of the logged in users' ldap file into the html application i would be grateful. Idealy i would add all the users in the LDAP with the service available to them displayed in a list of values.
    I dont know where to write the data in HTMLDB to do this - nor do i know the code itself.
    Any help you can give me on this would be very much appreciated.
    Thanks for your time
    Rob

  • Problem with JNDI/LDAP AND connection pool

    I'm a newbie to Java but am attempting to write a servlet that retrieves info use to populate the contents of drop down menus. I'd like to only have to do this once. The servlet also retrieves other data (e.g. user profile info, etc ...). I'd like to be able to use the connection pool for all of these operations but I'm getting a compile error:
    public class WhitePages extends HttpServlet {
    ResourceBundle rb = ResourceBundle.getBundle("LocalStrings");
    public static String m_servletPath = null;
    public static String cattrs = null;
    public static String guidesearchlist[] = {};
    public static int isLocalAddr = 0;
    private int aeCtr;
    private String[] sgDNArray;
    private HashMap sgDN2DNLabel = new HashMap();
    private HashMap sgDN2SearchGuide = new HashMap();
    private String strport;
    private int ldapport;
    private String ldaphost;
    private String ldapbinddn;
    private String ldapbindpw;
    private String ldapbasedn;
    private int maxsearchcontainers;
    private int maxsearchkeys;
    private String guidesearchbases;
    private String guidecontainerclass;
    private String strlocaladdr;
    private String providerurl;
    // my init method establishes the connection
    // pool and then retrieve menu data
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    String strport = config.getInitParameter("ldapport");
    ldapport = Integer.parseInt(strport);
    String strconts = config.getInitParameter("maxsearchcontainers");
    maxsearchcontainers = Integer.parseInt(strconts);
    String strkeys = config.getInitParameter("maxsearchkeys");
    maxsearchkeys = Integer.parseInt(strkeys);
    ldaphost = config.getInitParameter("ldaphost");
    ldapbinddn = config.getInitParameter("ldapbinddn");
    ldapbindpw = config.getInitParameter("ldapbindpw");
    ldapbasedn = config.getInitParameter("ldapbasedn");
    guidesearchbases = config.getInitParameter("guidesearchbases");
    guidecontainerclass = config.getInitParameter("guidecontainerclass");
    strlocaladdr = config.getInitParameter("localaddrs");
    providerurl = "ldap://" + ldaphost + ":" + ldapport;
    /* Set up environment for creating initial context */
    Hashtable env = new Hashtable(11);
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL, providerurl.toString());
    /* Enable connection pooling */
    env.put("com.sun.jndi.ldap.connect.pool", "true");
    StringTokenizer st = new StringTokenizer(guidesearchbases, ":" );
    String guidesearchlist[] = new String[st.countTokens()];
    for ( int i = 0; i < guidesearchlist.length; i++ ) {
    guidesearchlist[i] = st.nextToken();
    // Get a connection from the connection pool
    // and retrieve the searchguides
    StringBuffer asm = new StringBuffer(""); // This is the advanced search menu htmlobject buffer
    StringBuffer strtmpbuf = new StringBuffer(""); // This is the simple search menu htmlobject buffer
    try {
    StringBuffer filter = new StringBuffer("");
    filter.append("(objectclass=" + guidecontainerclass + ")");
    String[] attrList = {"dn","cn","searchguide"};
    SearchControls ctls = new SearchControls();
    ctls.setReturningAttributes(attrList);
    ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
    String attrlabelkey;
    sgDNArray = new String[guidesearchlist.length];
    for( int i = 0; i < guidesearchlist.length; i++ ) {
    // Search each of the namingspaces where
    // searchguides exist then build
    // the dynamic menus from the result
    DirContext ctx = new InitialDirContext(env);
    NamingEnumeration results = ctx.search(guidesearchlist, filter, ctls);
    I get a compile error:
    WhitePages.java:164: cannot resolve symbol
    symbol : method search (java.lang.String,java.lang.StringBuffer,javax.naming.directory.SearchControls)
    location: interface javax.naming.directory.DirContext
    NamingEnumeration results = ctx.search(guidesearchlist[i], filter, ctls);
    ^
    WhitePages.java:225: cannot resolve symbol
    symbol : variable ctx
    location: class OpenDirectory
    ctx.close();
    ^
    Can anyone help? If there is someone out there with JNDI connection pool experience I would appreciate your assistance!

    Manish
    The issue may not be related to the number of connections or the initial
    connections. Check your heap size (ms, mx). Turn on verbosegc. Your heap may
    not be big enough to accept the 25,000 rows.
    Bernie
    "Manish Kumar Singh" <[email protected]> wrote in message
    news:3e6c34ca$[email protected]..
    We are creating the result set with 25000 rows(each row has 56 columns) bygetting the connection using data source. With the initial capacity of the
    connection pool is 5 and the max capacity as 30 and grow connection as 1,
    the server gets out of memory exception, when we issue a new request, even
    after closing the previous connections.
    Now, if we change the initial capacity to 1 and rest all the things assame, the issue gets resolved and the server works fine.
    Could you please help me out in this regard????
    thanks in advance
    manish

  • 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.

  • 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

  • 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 Connections Pool

    Does anyone know if <cfldap> uses a connections pool? If not, can this be achieve by setting the ldap connections pool system properties since it's Java under the cover?
    Thanks.

    This is a bug in java version "1.7.0_17".
    Fixed in Java 1.7.0.40
    Bug # 7174887: Deadlock in jndi ldap connection cleanup.
    List of bugs fixed in the latst version is listed here Java™ SE Development Kit 7 Update 40 Bug Fixes
    Hope this helps!
    Regards,
    Shanmuga Catna

  • JNDI, LDAP, and Weblogic 6.0

    Hi-
    We are encountering an issue with JNDI and spurious "socket closed"
    exceptions. The players in our environment are Weblogic 6.0, Netscape
    Directory Server 4.1, (both running on Solaris 2.8) and JNDI as of JDK 1.3.
    We do JNDI lookups to connect to LDAP and most of the time everything works
    fine. Occasionally we get the following exception.
    java.lang.NullPointerException
    at com.sun.jndi.ldap.Connection.run(Connection.java:568)
    at java.lang.Thread.run(Thread.java:484)
    Exception encountered: Socket closed
    javax.naming.CommunicationException: Socket closed. Root exception is
    java.net.SocketException: Socket closed
    at java.net.SocketOutputStream.socketWrite(Native Method)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:83)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:72)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:130)
    at com.sun.jndi.ldap.Connection.writeRequest(Connection.java:210)
    at com.sun.jndi.ldap.LdapClient.search(LdapClient.java:497)
    at com.sun.jndi.ldap.LdapCtx.doSearch(LdapCtx.java:1720)
    at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1584)
    at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1509)
    at
    com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.ja
    va:371)
    at
    com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeD
    irContext.java:331)
    at
    com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeD
    irContext.java:316)
    at
    javax.naming.directory.InitialDirContext.search(InitialDirContext.java:241)
    at adpsis.posse.ldap.LDAPReader.find(LDAPReader.java:37)
    at adpsis.posse.prfpos.PreferencesEJB.getUserName(PreferencesEJB.java:589)
    at
    adpsis.posse.prfpos.PreferencesEJB.getColorAttributes(PreferencesEJB.java:39
    1)
    at
    adpsis.posse.prfpos.PreferencesEJB.getColorPreferences(PreferencesEJB.java:3
    02)
    at
    adpsis.posse.prfpos.PreferencesEJBImpl.getColorPreferences(PreferencesEJBImp
    l.java:250)
    at
    adpsis.posse.prfpos.PreferencesEJBEOImpl.getColorPreferences(PreferencesEJBE
    OImpl.java:287)
    at
    adpsis.posse.prfpos.PreferencesEJBEOImpl_WLSkel.invoke(PreferencesEJBEOImpl_
    WLSkel.java:116)
    at
    weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.java:373)
    at
    weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
    :128)
    at
    weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.java:237)
    at
    weblogic.rmi.internal.BasicRequestHandler.handleRequest(BasicRequestHandler.
    java:118)
    at
    weblogic.rmi.internal.BasicRequestDispatcher.dispatch(BasicRequestDispatcher
    .java:115)
    at weblogic.rmi.internal.ServerRequest.sendOneWayRaw(ServerRequest.java:88)
    at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:108)
    at
    weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
    :247)
    at
    weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
    :225)
    at
    adpsis.posse.prfpos.PreferencesEJBEOImpl_WLStub.getColorPreferences(Preferen
    cesEJBEOImpl_WLStub.java:221)
    at adpsis.posse.transformer.CSSServlet.doPost(CSSServlet.java:86)
    at adpsis.posse.transformer.CSSServlet.doGet(CSSServlet.java:214)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:748)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :213)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
    ntext.java:1265)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
    :1631)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    The only way to recover is to restart the Weblogic server. The LDAP server
    appears to be running normally and continues to service other instances of
    Weblogic. No errors are logged in the LDAP server, the JNDI lookup that
    establishes the DirContext works fine on restart and is used multiple times
    with no issues until..poof..socket closed. I'm not certain which part is at
    issue, Weblogic, LDAP, or JNDI.
    Any ideas?
    Regards,
    Brett Schmoll
    ADP/SIS

    WLS 6.0 will be supported in the next release of WLCS, which is due in the
    spring.
    - Ginny
    "aamerG" <[email protected]> wrote in message
    news:3a5cb774$[email protected]..
    Hi everyone,
    we are starting a new development project and would like to use Weblogic
    6.0. How soon do you think there we be a version of WLCS which works with
    6.0.
    TIA

  • Photo Directory LDAP Connection

    I keep getting "User Not Found" using the photodirectory.jsp. Are we supposed to hit the Call Manager server with LDAP queries? I've been trying to use our corporate LDAP (Active Directory) through our primary DC, but I've noticed a hard coded OU setting in the User.java that makes me suspect I should be using Call Manager in my searches.

    I have in fact done it, although my search method is pretty close to the sendRequest method by Cisco, except that I'm throwing custom exceptions back including all the info about the ldap query (I never quite could figure out what was going wrong unless you log that kind of thing) and my return values use generics so as to spare me the casting.
    One thing I added was search controls.. I'm doing server side sorting whenever possible, but you gotta be careful with that. AD supports it, OpenLDAP doesn't (I just banged me head for a while last week wondering about an error message I got back from an OpenLDAP server last week.. turns out it simply doesn't do server side sorting).. so you probably want to have a look at Collections.sort as well.
    You might also want to do some connection pooling by adding the following to the env variable:
    env.put("com.sun.jndi.ldap.connect.pool", "true");
    That way, your second and third request won't take so long to get the context initiated.. that's especially important if you do many queries to the same directory hierarchy (e.g. searching your AD users multiple times).
    But other than that, the LDAPProvider.java class is quite good.. it's the part above that that you need to change.. every directory needs a different root and base search path. When I first got started, I spent quite some time figuring out what to put as root and what as base search path.. I finally settled on accessing the directory by ldap browser, which can search for your roots, then use the most specific one, and use the path from that root down the tree until the branch that you want to search as the base search path (in Cisco's code they call it searchbase).
    Oh, and you might also want to be more flexible as to the scope.. sometimes one level is enough, sometimes it isn't (you can verify that by launching your search via ldapbrowser). Since ldapbrowser is java based, it's the ideal tool to make your tests.. it will be based on the same classes and methods you're going to be using, so if you can get it to work with ldapbrowser, you can get it to work in your code, and if ldapbrowser fails, there's no point wasting your time trying to adjust your own code.
    So my suggestion would be to make these few modifications to the cisco ldap provider, and then just worry about what you put above that (you need to process the hashmap with the results somehow).

  • Using JNDI to connect LDAP directory : pb of reconnection

    Hi everybody !
    I really need our help.
    I work with java servlets and i try to connect a LDAP directory with JNDI.
    When i launch my application, and when LDAP server is ready, connection is done, i get data from ldap, everything is ok.
    But when ldap server fails down, and startup, (my application doesn't stop), i can't connect again to ldap (ldap connext is not null). I get an error "Connection reset by peer, socket write error".
    I can't connect, even if i put my context null, and build another context, to get ldap data.
    Maybe its a problem of servlet programmation, or JNDI use, i don't know.
    Any ideas ?? Thanks you so much for your help !
    Here i give my code, to build ldap context (which is equivalent to a connection to ldap) :
    _env = new Hashtable();
    env.put(Context.INITIALCONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDERURL, "ldap://"+_ldapIPAddress+"/o=netcentrex");
    //securite
    env.put(Context.SECURITYAUTHENTICATION, "simple");
    env.put(Context.SECURITYPRINCIPAL, "cn=admin, o=div");
    env.put(Context.SECURITYCREDENTIALS, "admin");
    try
    ldapCtx = new InitialDirContext(env);
    catch(NamingException e)
    System.out.println("ConnectionLdap : Cannot get directory context for LDAP");

    Sorry, no need to reply !!
    I've found my error (3 days i am searching, and its a stupid null ldap address) !!!

  • JNDI LDAP Response Parsing Problems

    Help!
    I am having problems dealing with LDAP responses using JNDI 1.2.2 with the
    LDAP SPI.
    It seems that the detinguished name is unparsable but as far as I can see
    the server output is fine. Any clues how to get around this? Have I done
    something wrong or is the LDAP spi unusably buggy?
    Please could you also reply in mail as this is an urgent matter for the
    project I am working on. If the LDAP spi is unusable I will have to change
    direction completely...
    Thanks in advance,
    John
    The experimental code causing problems is this (except I have substituted
    hard coded values that were bombing into the code):
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL, "ldap://directory.verisign.com");
    InitialLdapContext context_ldap = new InitialLdapContext(env, null);
    Attributes match = new BasicAttributes(true);
    match.put(new BasicAttribute("cn", "microsoft"));
    NamingEnumeration enum = context_ldap.search("", match);
    NameParser parser = context_ldap.getNameParser("");
    while (enum.hasMore())
    SearchResult result = (SearchResult)enum.next();
    System.out.println("Parsing " + (result.isRelative() ? "[relative]: " :
    "[non-relative]: ") + result.getName());
    Name name = parser.parse(result.getName());
    The output is this:
    Parsing [relative]: "ou=MS INTERNAL TESTING
    ONLY,cn=Microsoft,l=redmond,st=wa,c=US,ou=Digital ID Class 3 - Microsoft
    Software Validation v2,ou=\"www.verisign.com/repository/CPS Incorp. by
    Ref.,LIAB.LTD(c)96\",ou=VeriSign Commercial Software Publishers
    CA,o=\"VeriSign, Inc.\",l=Internet"
    javax.naming.InvalidNameException: Invalid name: "ou=MS INTERNAL TESTING
    ONLY,cn=Microsoft,l=redmond,st=wa,c=US,ou=Digital ID Class 3 - Microsoft
    Software Validation v2,ou=\"www.verisign.com/repository/CPS Incorp. by
    Ref.,LIAB.LTD(c)96\",ou=VeriSign Commercial Software Publishers
    CA,o=\"VeriSign, Inc.\",l=Internet"
    at com.sun.jndi.ldap.LdapName$DnParser.parseAttrType(LdapName.java:478)
    at com.sun.jndi.ldap.LdapName$DnParser.parseRdn(LdapName.java:432)
    at com.sun.jndi.ldap.LdapName$DnParser.getDn(LdapName.java:400)
    at com.sun.jndi.ldap.LdapName.parse(LdapName.java:303)
    at com.sun.jndi.ldap.LdapName.<init>(LdapName.java:76)
    at com.sun.jndi.ldap.LdapNameParser.parse(LdapNameParser.java:23)
    at
    com.softcomms.trackomatic.ext.ldap.gui.LDAPViewer$ResultsTableModel.parseRes
    ult(LDAPViewer.java:304)
    at
    com.softcomms.trackomatic.ext.ldap.gui.LDAPViewer$1.run(LDAPViewer.java:240)
    at com.softcomms.trackomatic.util.RunQueue.run(RunQueue.java:109)

    at least you need cn= in front of the name.
    Here some more questions you may ask yourself:
    How do you know, that the requested object is in the database?
    What is its DN?
    Can you retrieve it using the ldap command line utilities like ldapsearch?
    What does context.list("") return?

  • EJB3: JNDI connection problem managed server

    Hi all,
    In a JUnit test, I tried to look up a Session EJB from a remote managed server:
    Hashtable<String, String> props = new Hashtable<String, String>();
    props.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    props.put(javax.naming.Context.PROVIDER_URL, "t3://server1.ux.yucom.es:1751");
    props.put(javax.naming.Context.SECURITY_PRINCIPAL, "userName");
    props.put(javax.naming.Context.SECURITY_CREDENTIALS, "pwd");
    props.put(weblogic.jndi.WLContext.ALLOW_EXTERNAL_APP_LOOKUP, "true");
    InitialContext context = new InitialContext(props);
    Command command = (Command) context.lookup(jndiName);
    But the code already fails while instantiating the InitialContext, because of a connection problem:
    Caused by: java.net.ConnectException: t3://server1.ux.yucom.es:1751: Destination unreachable; nested exception is:
         java.net.ConnectException: Connection timed out: connect; No available router to destination
         at weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:203)
         at weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:153)
         at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:352)
         ... 34 more
    Caused by: java.rmi.ConnectException: Destination unreachable; nested exception is:
         java.net.ConnectException: Connection timed out: connect; No available router to destination
         at weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:464)
         at weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:315)
         at weblogic.rjvm.RJVMManager.findOrCreateRemoteInternal(RJVMManager.java:251)
         at weblogic.rjvm.RJVMManager.findOrCreate(RJVMManager.java:194)
         at weblogic.rjvm.RJVMFinder.findOrCreateRemoteServer(RJVMFinder.java:225)
         at weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:188)
         ... 36 more
    I'm able to connect to the the Admin server... In this case I receive a javax.naming.NameNotFoundException, obviously, since the remote EJB is only targetted on the managed server and not on the admin.
    This is confirmed by following little test on the command line:
    java -cp %WL_HOME%\server\lib\weblogic.jar weblogic.Admin -url t3://server1.ux.yucom.es:1700 -username <user> -password <pwd> PING
    => OK, packets received
    java -cp %WL_HOME%\server\lib\weblogic.jar weblogic.Admin -url t3://server1.ux.yucom.es:1751 -username <user> -password <pwd> PING
    => Failure:
    Failed to connect to server1.ux.yucom.es:1751: Destination unreachable; nested exception is:
    java.net.ConnectException: Connection timed out: connect; No available router to destination
    Does anyone has an idea why the connection to the managed server fails??
    Is it a configuration problem in WebLogic?
    Thx a lot!
    Wim.

    Hi,
    Are you able to Remotely Access any Simple Web Application deployed on "server1.ux.yucom.es:1751".
    Example: http://server1.ux.yucom.es:1751/TestApp/index.jsp
    If NOT: Means Some where there is a problem with the Port...Just for testing Try Changin Manged Server port to Default HTTP Port (80).
    If Yes: Then there are chances that Your Box is not allowing any t3-Protocol Traffic on 1751 Port. Just for Testing Enable HTTP Tunneling on this Server from Admin Console
    AdminConsole --> Home-->Summary Of Servers --->ManagedServer1 ---> Protocol (Tab) ---> HTTP (SubTab) --->Enable Tunneling (Check This Check Box)    Save the changes.
    And then After restarting your Server ... Try to ping your Server using:
    java -cp %WL_HOME%\server\lib\weblogic.jar weblogic.Admin -url http://server1.ux.yucom.es:1751 -username <user> -password <pwd> PING
    In the Above command Use HTTP protocol instead of T3. If Now u are able to Ping the Server means Your Port 1751 was not allowing any other Protocol except HTTP.
    Thanks
    Jay SenSharma
    http://middlewaremagic.com/weblogic  (Middleware magic Is Here)

Maybe you are looking for

  • HTC One Google edition

    If i order the HTC ONE google edition from HTC or Google, can I put my sim card in it and use it on Verizon's network?

  • Multiple Processes dequeuing messages from same queue

    Hi, I have 2 Processes that are listening on the same queue to dequeu the messages. How can i make sure each process picks the message intended for that process. What setting do I need so that each process picks the right message not all the messages

  • Price Mass Update

    Gurus. I would like to mass update prices in consignment info-records for one vendor, i can see that the field price does not appear in tcode : MEMASSIN - Mass Maintenance . Do i have to create a contract to use after MEKRE an then later update the I

  • Color Finesse 3 & Premier CS6 ?

    Hello i have Production Premium CS6 on my Win 7 x64, i am still new to  editing, just learning, but what i noticed is that i have in my AE -  Color Finesse 3, but for now AE is too complicated for me and i dont  like working in AE as when i import my

  • Special access right for PA20 and PA30

    Hello Experts! I have a problem and was wondering how it would be configured in SAP, any help would be greatly appreciated. How to config the security access right, if the logon user is the member of specify role, he/she is not allow to access the de