Bonjour,

je développe une application qui modifier, ajout, et supprimer des donnée dans un LDAP.

j'essaye d'ajouté un objet (sérialiser) mais j'ai un problème dans la fonction bind(...)

voilà mon code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  public static void main(String[] args) { 
		    Hashtable env = new Hashtable(); 
		    env 
		        .put(Context.INITIAL_CONTEXT_FACTORY, 
		            "com.sun.jndi.ldap.LdapCtxFactory"); 
		    env.put(Context.PROVIDER_URL, "ldap://localhost:389"); 
		    env.put(Context.SECURITY_AUTHENTICATION, "simple"); 
		    env.put(Context.SECURITY_PRINCIPAL, "cn=Zidane,dc=foot,dc=com"); 
		    env.put(Context.SECURITY_CREDENTIALS, "secret"); 
		    DirContext dirContext; 

		    try { 

		      dirContext = new InitialDirContext(env); 
		      MonObjet objet = new MonObjet("valeur1","valeur2"); 

		      dirContext.bind("cn=monobject,dc=foot,dc=com", objet); 
		      dirContext.close(); 

		    } catch (NamingException e) { 
		      System.err.println("Erreur lors de l'acces au serveur LDAP" + e); 
		      e.printStackTrace(); 
		    } 
		    System.out.println("fin des traitements"); 
	  }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
 
import java.io.Serializable; 
 
public class MonObjet implements Serializable { 
 
  //private static final long serialVersionUID = 3309572647822157460L; 
  private String champ1; 
  private String champ2; 
 
  public MonObjet() { 
    super(); 
  } 
 
  public MonObjet(String champ1, String champ2) { 
    super(); 
    this.champ1 = champ1; 
    this.champ2 = champ2; 
  } 
 
  public String getChamp1() { 
    return champ1; 
  } 
 
  public void setChamp1(String champ1) { 
    this.champ1 = champ1; 
  } 
 
  public String getChamp2() { 
    return champ2; 
  } 
 
  public void setChamp2(String champ2) { 
    this.champ2 = champ2; 
  } 
}

voilà l'erreur :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
 
Erreur lors de l'acces au serveur LDAPjavax.naming.directory.InvalidAttributeIdentifierException: [LDAP: error code 17 - javaSerializedData: attribute type undefined]; remaining name 'cn=monobject,dc=foot,dc=com'
javax.naming.directory.InvalidAttributeIdentifierException: [LDAP: error code 17 - javaSerializedData: attribute type undefined]; remaining name 'cn=monobject,dc=foot,dc=com'
	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 JNI.main(JNI.java:217)

Est-ce qu'il y a quelqu'un qui puisse m'aider ?? merci