Cannot create and add a new entry to LDAP

Hi,
I'm pretty new at LDAP and JNDI, i've been trying to create and add a new entry to the directory but somehow it's not working.
here is my code and I would appreciate it if someone can help.
import java.util.Hashtable;
import javax.naming.ldap.*;
import javax.naming.directory.*;
import javax.naming.*;
import javax.net.ssl.*;
import java.io.*;
public class Newuser
     public static void main (String[] args)
          //LDAPEntry myEntry = new LDAPEntry();
          Hashtable<String, String> env = new Hashtable<String, String>(11);
          String adminName = "CN=ldap_admin,o=JNDITutorial,dc=img,dc=org";
          String adminPassword = "secret";
          env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
          //set security credentials, note using simple cleartext authentication
          env.put(Context.SECURITY_AUTHENTICATION,"simple");
          env.put(Context.SECURITY_PRINCIPAL,adminName);
          env.put(Context.SECURITY_CREDENTIALS,adminPassword);
          //connect to my domain controller
          env.put(Context.PROVIDER_URL, "ldap://localhost:389/o=JNDITutorial,dc=img,dc=org");
               // Create the initial directory context
               //JNDILDAPConnectionManager jndiManager = new JNDILDAPConnectionManagerImpl();
              try{
                   DirContext ctx = new InitialDirContext(env);
                    System.out.println("Connection to LDAP server done" );
                   final String groupDN ="ou=people,o=JNDITutorial,dc=img,dc=org";
                  //DirContext dirCtx = jndiManager.getLDAPDirContext();
                  People people = new People("Thiru","Thiru","Thiru Ganesh","Ramalingam","ou=people","[email protected]");
                  // The Common name must be equal in Attributes common Name
                  ctx.bind("cn=Thiru," + groupDN, people);
                  System.out.println("** Entry added **");
                  //jndiManager.disConnectLDAPConnection(ctx);
              }catch(NamingException exception){
                  System.out.println("**** Error ****");
                  exception.printStackTrace();
                  System.exit(0);
}here is the Object class People that i'm trying to instantiate
public class People implements DirContext {
     public People(String uid,String cn,String givenname,String sn,String ou,String mail) {
    BasicAttributes myAttrs = new BasicAttributes(true);  //Basic Attributes
    Attribute objectClass = new BasicAttribute("objectclass"); //Adding Object Classes
    objectClass.add("inetOrgPerson");
    /*objectClass.add("organizationalPerson");
    objectClass.add("person");
    objectClass.add("top");*/
    Attribute ouSet = new BasicAttribute("ou");
    ouSet.add("people");
    ouSet.add(ou);
    myAttrs.put(objectClass);
    myAttrs.put(ouSet);
    myAttrs.put("cn",cn);
    myAttrs.put("sn",sn);
    myAttrs.put("mail",mail);
...the message i keep getting is:
javax.naming.directory.SchemaViolationException: [LDAP: error code 65 - entry has no objectClass attribute]
the thing is that I can create and add a new entry in openLDAP from the console and it works.
and here is how I proceed
I create a text file: new.txt
dn:cn=Hamido Saddo,ou=People,o=JNDITutorial,dc=img,dc=org
cn:Hamido Saddo
mail:[email protected]
telephonenumber:3838393038703
sn:hamdio
objectclass:top
objectclass:person
objectclass:organizationalPerson
objectclass:inetOrgPersonand i use this command to add the entry:
ldapadd -D "cn=ldap_admin,O=JNDITutorial,dc=img,dc=org" -W -f new.txtand everything works, i get no errors.
does anyone has a clue maybe???

You must have an IMAP email account in order to add additional folders on the iPad mail app.
If you go to your email account in the Mail app and look at the window where your inbox, trash folder and sent folder are - if there is an Edit button at the top of the window - tap that and then tap Add Mailbox at the bottom.
If the Edit button is not there - you cannot create folders on the iPad. Your email account is not IMAP. Only IMAP email accounts can create folders on the iPad. Any folders that you would already have in an IMAP account would sync to the device as well.

Similar Messages

  • How to create and add a new panel(under commenting list)?

    Hi,
    I'm basically a vc++ developer and new to this acrobat X.
    My requirement is to add a new subpanel under the commenting list.(Toolpane(right hand side)-> comment->commentinglist))
    I'm unable to find the soultion.Please help me in this.
    regards
    lavanya

    Is the class public (“public ref class MyUserControl”) and did you open the Form Designer before checking the toolbox? The user controls should appear automatically after rebuilding the solution.

  • I want to create and add a new iCloud email address to current apple id

    I've just gotten married and want to create a new iCloud email reflecting my new name, and then add it to my current iCloud account.  Is this possible??

    Welcome to the Apple Community.
    Providing you aren't trying to change you Apple iCloud email address you can make changes at My Apple ID

  • I Can't create and add en entry in Ldap using Java

    Hello there,
    I'm pretty new to LDAP programming, and I have been trying to create and add an entry to a directory using the code sample provided in the JNDI tutorial, but for some reasons, I didn't manage.
    the configuration file is well set up because I can't create, add, delete and modify just about anything I want from openLDAP command lines, but my real problem is to do it with java.
    here is my code:
    import java.util.Hashtable;
    import javax.naming.ldap.*;
    import javax.naming.directory.*;
    import javax.naming.*;
    import javax.net.ssl.*;
    import java.io.*;
    public class Newuser
         public static void main (String[] args)
              //LDAPEntry myEntry = new LDAPEntry();
              Hashtable<String, String> env = new Hashtable<String, String>(11);
              String adminName = "CN=ldap_admin,o=JNDITutorial,dc=img,dc=org";
              String adminPassword = "xxxxxx";
              env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
              //set security credentials, note using simple cleartext authentication
              env.put(Context.SECURITY_AUTHENTICATION,"simple");
              env.put(Context.SECURITY_PRINCIPAL,adminName);
              env.put(Context.SECURITY_CREDENTIALS,adminPassword);
              //connect to my domain controller
              env.put(Context.PROVIDER_URL, "ldap://localhost:389/o=JNDITutorial,dc=img,dc=org");
                   // Create the initial directory context
                   //JNDILDAPConnectionManager jndiManager = new JNDILDAPConnectionManagerImpl();
                  try{
                       DirContext ctx = new InitialDirContext(env);
                        System.out.println("Connection to LDAP server done" );
                       final String groupDN ="ou=people,o=JNDITutorial,dc=img,dc=org";
                      //DirContext dirCtx = jndiManager.getLDAPDirContext();
                      People people = new People("Thiru","Thiru","Thiru Ganesh","Ramalingam","ou=people","[email protected]");
                      // The Common name must be equal in Attributes common Name
                      ctx.bind("cn=Thiru," + groupDN, people);
                      System.out.println("** Entry added **");
                      //jndiManager.disConnectLDAPConnection(ctx);
                  }catch(NamingException exception){
                      System.out.println("**** Error ****");
                      exception.printStackTrace();
                      System.exit(0);
    }adn this is the class People that i want to instantiate
    import java.util.Hashtable;
    import javax.naming.Binding;
    import javax.naming.Context;
    import javax.naming.Name;
    import javax.naming.NameClassPair;
    import javax.naming.NameParser;
    import javax.naming.NamingEnumeration;
    import javax.naming.NamingException;
    import javax.naming.directory.*;
    public class People implements DirContext {
         public People(String uid,String cn,String givenname,String sn,String ou,String mail) {
        BasicAttributes myAttrs = new BasicAttributes(true);  //Basic Attributes
        Attribute objectClass = new BasicAttribute("objectclass"); //Adding Object Classes
        objectClass.add("inetOrgPerson");
        /*objectClass.add("organizationalPerson");
        objectClass.add("person");
        objectClass.add("top");*/
        Attribute ouSet = new BasicAttribute("ou");
        ouSet.add("people");
        ouSet.add(ou);
        myAttrs.put(objectClass);
        myAttrs.put(ouSet);
        myAttrs.put("cn",cn);
        myAttrs.put("sn",sn);
        myAttrs.put("mail",mail);
    }as I said, I can add the new entry using an LDIF file "new.txt" that looks like this:
    dn:cn=Hamido Saddo,ou=People,o=JNDITutorial,dc=img,dc=org
    cn:Hamido Saddo
    mail:[email protected]
    telephonenumber:3838393038703
    sn:hamido
    objectclass:top
    objectclass:person
    objectclass:organizationalPerson
    objectclass:inetOrgPersonusing the following command:
    ldapadd -D "cn=ldap_admin,o=JNDITutorial,dc=org,dc=img" -W -f new.txtand eveything works
    but when i try with the java, i get the following error:
    javax.naming.directory.SchemaViolationException: [LDAP: error code 65 - entry has no objectClass attribute]
    so, can anyone help me please !!!

    uncomment these lines
    /*objectClass.add("organizationalPerson");
    objectClass.add("person");
    objectClass.add("top");*/
    you need all of them to add successfully
    your LDIF has all the four lines
    objectclass:top
    objectclass:person
    objectclass:organizationalPerson
    objectclass:inetOrgPerson
    hope this helps

  • How can I add a new entry for determining a requirement type

    Dear Friends,
    How can I add a new entry for determining a requirement type
    via Item Category + MRP type,  I see no new entries selection.
    This is in  Avb Check & TOR-> TOR-> Determination of req type using transaction.
    Please help.
    Regards
    Ravi.

    Availability Check and Transfer of Requirements > Transfer of Requirements > Define Requirements Types ?
    Just one node above?
    Never mind, you need to add entry on item category:S

  • Check 2 tables(Table A and Table B) and figure out new columns present in Table A and add these new columns to Table B

    How to check 2 tables(Table A and Table B) and figure out new columns present in Table A and add these new columns to Table b.
    DDL-
    Create table A
    ( A INT,
    B INT,C VARCHAR(2)
    Create table B
    A INT,
    B INT
    Any advice on the best approach or method to achieve this.
    I understand that I need to check the schema of the columns and then do a match between 2 tables and find new columns and then alter my target table
    Mudassar

    Can you try this..
    CREATE TABLE A ( A INT, B INT, C VARCHAR(2) )
    CREATE TABLE B ( A INT, B INT )
    Declare @ColumnVar nvarchar(128),@DatatypeVar nvarchar(128)
    SELECT @ColumnVar=x.COLUMN_NAME, @DatatypeVar=x.DATA_TYPE
    FROM INFORMATION_SCHEMA.COLUMNS AS x
    WHERE TABLE_NAME = 'A'
    AND NOT EXISTS ( SELECT *
    FROM INFORMATION_SCHEMA.COLUMNS
    WHERE TABLE_NAME = 'B'
    AND COLUMN_NAME = x.COLUMN_NAME )
    Declare @SQL VarChar(1000)
    SELECT @SQL = 'ALTER TABLE B ADD ' + @ColumnVar + ' '+ @DatatypeVar
    Exec (@SQL)
    select * from B
    Please Mark This As Answer if it helps to solve the issue
    http://stackoverflow.com/questions/2614101/alter-table-my-table-add-column-int

  • HT1329 I do not have my old computer and i want to take music on ipod and add to new computer

    I do not have my old computer and i want to take music on ipod and add to new computer

    You cannot transfer song files from iPod to computer using iTunes (except for songs purchased from the iTunes Store).  However, there are third-party methods and utilities that can transfer from iPod to computer.  If you do a Google search on something like "ipod transfer," you should get some links.
    NOTE:  Previous purchases from the iTunes Store can be re-downloaded at no cost from the iTunes Store Purchased screen.

  • I have changed settings on my email account with my provider, but in order to activate the address they instructed me to delete my account and add a new account with the same email address. Will this delete my all my email history? Any advise please?

    I have an OS X 10.6.8 and have had problems with my mail. I have changed my account settings with my mail provider, but they suggest I now delete my account and add a new account with the same email address. Will this delete my email history? Can anyone please advise?

    I have the same problem as the emails go to my iCloud account that I cannot access!!! I cannot answer the security questions as someone else must have set up my iCloud account. Nothing seems to work. It would be great if someone has some ideas as what can be done to recover the situation?

  • HT1296 I'm having difficulty syncing my iCal between my home computer and iPhone.  New entries from my home are not syncing with the phone and vice-versa.  I didn't have any problems with this before until the latest phone update.  Any suggestions?

    I'm having difficulty syncing my iCal between my home computer and iPhone.  New entries from my home are not syncing with the phone and vice-versa.  I didn't have any problems with this before until the latest phone update.  Any suggestions?

    It could be that the existing wire in your appartment is not clean enough to provision DSL only. When combined with the phone possibly it has a higher line voltage and worked before. Now that the line is to be provisioned without phone service it may be giving them trouble that did not show before they came out and ran the new line test. So a new jack dedecated for your DSL line may require a new wire be run to your appartment. Also the account for internet only used to require direct billing to a credit card or something else. This was a number of years ago. Most accounts are linked to a phone number, and without a voice number it adds to the confusion.
    If you are getting the voice and everything turned on as before, then I am at a loss for words.

  • Ive changed my apple id. in my iPad and iPhone under iTunes it's showing the new id but under iCloud still shows old I'd. I have been told to delete account and add in new one but worried in case lose all my stuff that's already saved in iCloud. any idea?

    Ive changed my apple id. in my iPad and iPhone under iTunes it's showing the new id but under iCloud still shows old I'd. I have been told to delete account and add in new one but worried in case lose all my stuff that's already saved in iCloud. any idea?

    If all you did was rename your ID, you can go to Settings>iCloud, tap Delete Account, choose Delete from My iPhone when prompted, then sign back in with your renamed ID.  Deleting the account only deletes the account and any data you are syncing with iCloud from your phone, not from iCloud.  Provided you are signing back into the same account and not changing accounts, your data will be synced back to your phone when you sign back in.
    If, however, you are changing to a new account with a new ID, choose Keep on My iPhone when prompted.  Then choose Merge when you sign into the new account and turn your iCloud syncing back on to upload your data to the new account.
    Before deleting the account, save you photo stream photos to your camera roll (tap Edit, tap all the photos, tap Share, tap Save to Camera Roll).

  • How to create and implement a new work schedule rule successfully?

    Dear Community,
    How to create and implement a new work schedule rule successfully?
    In other words, what are all the basic steps to create and implement a new work schedule rule successfully?
    Thanks in advance.

    Hi,
    Follow the below steps to create Work Schedule:
    Holiday Calendar
    Transaction Code: SCAL
    Holiday calendar comprises of list of paid holidays to be given to employees on festivals by the company.
    Personnel Area/SubArea Groupings
    Go to SPRO --> Time Management --->Work Schedules --> Personnel SubArea Groupings
    Maintain perosnnel area/Subarea groupings for work schedule.
    i.e. Suppose in Mumbai you have WS = GEN ( 10 to 6) and in Chennai you have WS = NORM ( 8 to 4 )
    Work Schedule
    Go to SPRO --> Time Management --->Work Schedules -->Daily Work Schedules
    Go to SPRO --> Time Management --->Work Schedules -->Period Work Schedules
    Daily Work Schedule is actually your office timings with breaks (paid /unpaid) i.e. Planned Working Time which is then included
    in Period Work Schedule to make a week ( M T W T F S S )
    Daily Work Schedule (i.e. Day) -
    > Period Work Schedule (i.e. Week)
    Work Schedule Rules
    Go to SPRO --> Time Management --->Work Schedules -->Work Schedule Rules and Work Schedules
    After doing above mentioned configurations,maintain employee group/subgroup groupings in which you have to define which calendar is applicable for which type of employees for which work schedule.
    You will maintain this work schedule in infotype 0007 - Planned Working Time of employee via transaction code - PA30

  • [svn:bz-trunk] 10059: update two package-info.java files, and add one new one.

    Revision: 10059
    Author:   [email protected]
    Date:     2009-09-08 11:31:48 -0700 (Tue, 08 Sep 2009)
    Log Message:
    update two package-info.java files, and add one new one.
    Modified Paths:
        blazeds/trunk/modules/proxy/src/flex/messaging/services/http/proxy/package-info.java
    Added Paths:
        blazeds/trunk/modules/core/src/flex/messaging/util/concurrent/package-info.java
        blazeds/trunk/modules/core/src/flex/messaging/validators/package-info.java

    Revision: 10059
    Author:   [email protected]
    Date:     2009-09-08 11:31:48 -0700 (Tue, 08 Sep 2009)
    Log Message:
    update two package-info.java files, and add one new one.
    Modified Paths:
        blazeds/trunk/modules/proxy/src/flex/messaging/services/http/proxy/package-info.java
    Added Paths:
        blazeds/trunk/modules/core/src/flex/messaging/util/concurrent/package-info.java
        blazeds/trunk/modules/core/src/flex/messaging/validators/package-info.java

  • How to create and add table type to a DDIC Structure in sap 3.1H

    How to create and add table type to a DDIC Structure in sap 3.1H

    How to create and add table type to a DDIC Structure in sap 3.1H

  • Hi All,How2 delete a pkey for std table and add 2 new primary keys

    Hi All,
            How2 delete a pkey for std table and add 2 new primary key fields .Please provide me the required procedure .
    Thanks&Regards.
    Bharat.

    Hi Bharat,
    First thing is you need to have the access key to change any standard dictionary object/standard programs/ standard transactions.You may get this from your basis person after getting approval from your respective manager.But changing or modifying the standard object is not recommended, but if there is no alternate to meet the business requirement then we have to follow this way only.
    Next, you need to check whether this table's primary key is being used in any other table as foreing key or not. If there is, then you must remove this relation and then you can delete the unncessary primary key field from that table.Finally you can add the two new fields and set them as primary key, save, check for any errors and activate.
    Hope this helps.
    Please reward if useful.
    Thanks,
    Srinivasa

  • My apple id email address is no longer valid. my current email address is recognised as my rescue email...i need to cancel old, change my current and add a new recue email...cant seem to be able too

    my apple id email address is no longer valid. my current email address is recognised as my rescue email...i need to cancel old, change my current and add a new recue email...cant seem to be able too

    How are you trying to do it ? You can change the rescue email address on your account by, from http://support.apple.com/kb/HT5312 :
    Navigate to appleid.apple.com using your web browser.
    Click "Manage your account"
    When prompted, sign in using your Apple ID and password.
    Click Password & Security
    You'll be asked to answer 2 of your 3 security questions before you can make any modifications. If you are unable to remember your answers, you can choose to send an email to your rescue email to reset your security questions.
    After you've validated your identity by correctly answering your security questions, click Edit to the right of your rescue email address.
    Once you've finished editing your rescue email address, click the Save button directly below the email field.
    You can then try using your current rescue email address as your primary email address - you may need to log out of that page and back in. Or you can then try changing the primary email address via the Store > View Account menu option on your computer's iTunes
    If you have an iPhone, iPad and/or iPod Touch you may then need to log out of your account on them by tapping on it in Settings > iTunes & App Store and log back in for the account to be 'refreshed' on it.

Maybe you are looking for

  • Split tab delimited file

    Hiall, I filled an internal table with the data from a tab delimited file (trought the FM FTP_TOR3). All my date is in the internal table, but I want to split it now. I tried with the '#' (as ALT + 3), but he doesn 't split the line. I'm on 4.6, so I

  • All the sqr process are results in error

    While running any sqr process,it's erroring out with the below mentioned error output.All other process are running fine.Please help me to fix the issue. PeopleTools 8 - PSSQR Copyright (c) 1988-2005 PeopleSoft, Inc. All Rights Reserved Invalid datab

  • Wireless connection drops at random

    Hi, I have a 27" late 2011 iMAC. Since I updated to Lion my wireless connection drops at random. The wireless symbol shows that I am connected, but i cannot use the internet. The sollution at that time is that I turn off wireless, and than turn it on

  • Amount in Figures (FI)

    Hi Experts,, When we make payment thru F-53, and print the cheque, the amount in words appears in terms of lacs and crores, but amount in figures appears in millions? I checked in SU01 and SU3, under defaults, in decimal notations, there is no such o

  • Mystery conflicts from events that never occured

    Help! During syncs, the conflict resolver reports routinely that I have a great number of sync conflicts that must be resolved between iCal and SOHO Sync. Confusingly, I find that the supposed conflicts are bizarre echoes of events that may (appointm