Ldpa+java

5ou5a2012 Messages postés 14 Date d'inscription mercredi 22 décembre 2010 Statut Membre Dernière intervention 23 juillet 2012 - 23 juil. 2012 à 12:16
 Utilisateur anonyme - 23 juil. 2012 à 15:38
Bonjour,
j'ai un serveur openldap intégré dans une application java.j'utlise API Jdom pour créer un fichier de configuration (qui contient touts les paramètres de connexion.
le fichier configuration et comme suit:

<?xml version= "1.0" encoding="UTF-8"?>
<serverLDAP>

com.sun.jndi.ldap.LdapCtxFactory
ldap://192.168.198.131:389


<SECURITY_AUTHENTICATION>simple</SECURITY_AUTHENTICATION>
<SECURITY_PRINCIPAL>cn =admin,dc=xtensus,dc=com</SECURITY_PRINCIPAL>
<SECURITY_CREDENTIALS>ikhlass</SECURITY_CREDENTIALS>

</serverLDAP>
je veux faire une méthode qui me permet d'appeler ce fichier avec l'API JDOM comme suit:
public Hashtable getConnexion(){
Hashtable hashtable =new Hashtable() ;

String initilContxt="";
String URL="";
String securityAuth="";
String securityPrincipal="";
String securityCredential="";

hashtable.put(initilContxt, getElement("INITIAL_CONTEXT_FACTORY"));
hashtable.put(URL, getElement("PROVIDER_URL"));
hashtable.put(securityAuth, getElement("SECURITY_AUTHENTICATION"));
hashtable.put(securityPrincipal, getElement("SECURITY_PRINCIPAL"));
hashtable.put(securityCredential, getElement("SECURITY_CREDENTIALS"));

return hashtable ;
}


public String getElement(String elementName){
org.jdom.Document document;
Element racine;
SAXBuilder sxb = new SAXBuilder();
String elementValue = "" ;

try {
document = sxb.build(new File("LdapConfiguration.xml"));
racine = document.getRootElement();
elementValue = racine.getChildText(elementName);

} catch (JDOMException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return elementValue;
******************
lorsque j'excute cette classe un erreur se présente comme suit :
(java.lang.NoSuchMethodError: main
Exception in thread "main")
qui peux m'aider SVP

1 réponse

Utilisateur anonyme
23 juil. 2012 à 15:38
Salut,

Question toute bête, ta classe que tu exécutes a-t-elle une méthode main ? Car la visiblement, tu veux exécuter un programme qui n'a pas de main. Ou alors tu exécutes la mauvaise classe de ton programme.


--
Pylouq
(Lire le Réglement n'a jamais tué personne, au pire ça a instruit des gens.)
0
Rejoignez-nous