2010-06-10 13 views
1

J'utilise le printemps 3.0.2 et 1.5.5 ApacheDS et je suis en train d'exécuter le serveur embarqué utilisant:Spring Embedded Server

<ldap-server ldif="classpath:conf/users.ldif" port="39999"/> 

Le contenu du fichier est user.s.ldif:

dn: cn=The Postmaster,dc=example,dc=com 
objectClass: organizationalRole 
cn: The Postmaster 

Mais je reçois toujours cette erreur:

16566 [main] INFO org.apache.directory.server.protocol.shared.store. LdifFileLoader - Could not create entry ClientEntry 
dn: cn=The Postmaster,dc=example,dc=com 
objectclass: organizationalRole 
cn: The Postmaster 

org.apache.directory.shared.ldap.exception.LdapNam eNotFoundException: Cannot find a partition for 2.5.4.3=the postmaster,0.9.2342.19200300.100.1.25=example,0.9.2342.19200300.100.1.25=com 
at org.apache.directory.server.core.partition.DefaultPartitionNexus.getPartition(DefaultPartitionNexus. java:1082) 
at org.apache.directory.server.core.partition.DefaultPartitionNexus.hasEntry(DefaultPartitionNexus.java :1037) 
at org.apache.directory.server.core.interceptor.InterceptorChain$1.hasEntry(InterceptorChain.java:167) 
at org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.hasEntry(InterceptorChain.java :1300) 
at org.apache.directory.server.core.interceptor.BaseInterceptor.hasEntry(BaseInterceptor.java:159) 
at org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.hasEntry(InterceptorChain.java :1300) 
at org.apache.directory.server.core.interceptor.BaseInterceptor.hasEntry(BaseInterceptor.java:159) 
at org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.hasEntry(InterceptorChain.java :1300) 
at org.apache.directory.server.core.exception.ExceptionInterceptor.add(ExceptionInterceptor.java:154) 
at org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.add(InterceptorChain.java:1196) 
at org.apache.directory.server.core.referral.ReferralInterceptor.add(ReferralInterceptor.java:251) 
at org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.add(InterceptorChain.java:1196) 
at org.apache.directory.server.core.authn.AuthenticationInterceptor.add(AuthenticationInterceptor.java: 212) 
at org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.add(InterceptorChain.java:1196) 
at org.apache.directory.server.core.normalization.NormalizationInterceptor.add(NormalizationInterceptor .java:126) 
at org.apache.directory.server.core.interceptor.InterceptorChain.add(InterceptorChain.java:756) 
at org.apache.directory.server.core.DefaultOperationManager.add(DefaultOperationManager.java:260) 
at org.apache.directory.server.core.DefaultCoreSession.add(DefaultCoreSession.java:145) 
at org.apache.directory.server.core.DefaultCoreSession.add(DefaultCoreSession.java:122) 
at org.apache.directory.server.protocol.shared.store.LdifFileLoader.execute(LdifFileLoader.java:204) 
at org.springframework.security.ldap.server.ApacheDSContainer.importLdifs(ApacheDSContainer.java:237) 
at org.springframework.security.ldap.server.ApacheDSContainer.start(ApacheDSContainer.java:189) 

Des idées? Merci d'avance!

Répondre

0

Tout d'abord, je suppose que votre fichier LDIF est en fait divisé sur plusieurs lignes, comme suit:

dn: cn=The Postmaster,dc=example,dc=com 
objectClass: organizationalRole 
cn: The Postmaster 

... sinon vous même pas obtenir aussi loin que vous êtes.

Mais pour répondre à votre question, l'erreur se produit parce que vous essayez d'ajouter quelque chose (dans ce cas, un rôle organisationnel) à un contexte qui n'existe pas ("dc = example, dc = com"). Essayez de changer ce contexte pour celui qui existe. Je ne peux pas dire ce que ce serait sans voir votre fichier Spring Bean, mais par défaut, le serveur LDAP intégré de Spring utilise une racine de "dc = springframework, dc = org", alors essayez de changer votre fichier LDIF en:

dn: cn=The Postmaster,dc=springframework,dc=org 
objectClass: organizationalRole 
cn: The Postmaster 

J'ai testé cela avec Spring 3.0.3.RELEASE et ApacheDS 1.5.5.

P.S. lors de la publication sur StackOverflow, veuillez formater votre code, empiler les traces, tester les données etc. comme code (par exemple, en mode édition, surlignez le texte concerné et cliquez sur le bouton "Exemple de code"). Cela rend votre message beaucoup plus lisible et les gens sont donc plus susceptibles de vous aider.

6

J'ai rencontré le même problème. La solution consistait à ajouter le contexte correct en tant que "root" - Attribut de la balise ldap-server dans Spring Security. Dans votre cas:

<security:ldap-server ldif="classpath:foo.ldif" root="dc=example,dc=com"/>