Spring嵌入式服务器

发布于 2024-09-04 18:00:08 字数 3042 浏览 3 评论 0原文

我正在使用 spring 3.0.2 和 ApacheDS 1.5.5,并且我尝试使用以下命令运行嵌入式服务器:

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

user.s.ldif 文件的内容是:

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

但我总是收到此错误:

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)

有什么想法吗? 提前致谢!

I'm using spring 3.0.2 and ApacheDS 1.5.5 and I'm trying to run the embedded server using:

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

The content of the user.s.ldif file is :

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

But I always get this error:

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)

Any Ideas ?
Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

§对你不离不弃 2024-09-11 18:00:08

我遇到了同样的问题。解决方案是在 Spring Security 中添加正确的上下文作为 ldap-server 标记的“root”属性。
在你的情况下:

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

I experienced the same problem. The solution was to add the correct context as "root"-Attribute of ldap-server tag in Spring Security.
In your case:

<security:ldap-server ldif="classpath:foo.ldif"  root="dc=example,dc=com"/>
逆蝶 2024-09-11 18:00:08

首先,我假设您的 LDIF 文件实际上分为几行,如下所示:

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

...否则您甚至不会得到现在的结果。

但要回答您的问题,会发生错误,因为您试图将某些内容(在本例中为organizationalRole)添加到不存在的上下文(即“dc=example,dc=com”)。尝试将该上下文更改为确实存在的上下文。如果没有看到您的 Spring bean 文件,我无法说出这是什么,但默认情况下,Spring 的嵌入式 LDAP 服务器使用“dc=springframework,dc=org”的根,因此请尝试将您的 LDIF 文件更改为此:

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

我测试了这个与 Spring 3.0.3.RELEASE 和 ApacheDS 1.5.5 一起使用。

PS,发布到 StackOverflow 时,请将您的代码、堆栈跟踪、测试数据等格式化为代码(例如,在编辑模式下,突出显示相关文本并单击“代码示例”按钮)。它使您的帖子更具可读性,因此人们更有可能为您提供帮助。

First off, I assume your LDIF file is actually split over several lines, as follows:

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

... otherwise you wouldn't even be getting as far as you are.

But to answer your question, the error happens because you're trying to add something (in this case an organizationalRole) to a context that doesn't exist (i.e. "dc=example,dc=com"). Try changing that context to one that does exist. I can't say what this would be without seeing your Spring bean file, but by default, Spring's embedded LDAP server uses a root of "dc=springframework,dc=org", so try changing your LDIF file to this:

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

I tested this with Spring 3.0.3.RELEASE and ApacheDS 1.5.5.

P.S. when posting to StackOverflow, please format your code, stack traces, test data etc. as code (e.g. in edit mode, highlight the relevant text and click the "Code sample" button). It makes your post much more readable and people are therefore more likely to help you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文