gpt4 book ai didi

java - 使用LdapContextSource的Spring LDAP为com.sun.jndi.ldap.ctl.ResponseControlFactory提供NoClassDefFoundError

转载 作者:行者123 更新时间:2023-12-01 05:04:27 24 4
gpt4 key购买 nike

我正在尝试使用spring-ldap org.springframework.ldap.support.LdapContextSource类访问LDAP。

以下是我的代码。

config file

<bean id="contextSource"
class="org.springframework.ldap.support.LdapContextSource">
<property name="url" value="ldap://url:11539" />
<property name="base" value="o=ctc" />
<property name="userName" value="cn=admin,ou=Users,ou=CFG,o=ctc" />
<property name="password" value="password" />
</bean>


<bean id="ldapTemplate" class="org.springframework.ldap.LdapTemplate">
<constructor-arg ref="contextSource" />
</bean>

<bean id="mail_AdapterImpl"
class="com.MAIL_AdapterImpl">
<property name="ldapTemplate" ref="ldapTemplate" />
<property name="mailAccount" ref="LdapDTO" />
</bean>



Impl class



private LdapTemplate mail_ldapTemplate;
private Ldap_DTO mailAccount;
private LdapTemplate ldapTemplate;

// logger used for logging the actions (request/response)
static final Logger usage_log = Logger.getLogger("USAGE");
List l = new ArrayList();

public boolean isPabguidExists(HashMap transferObject) {

if(ldapTemplate != null)
{
mapp_logger.info("Inside ldapTemplate not null");
l = ldapTemplate.search("", "(cn=04543552)",new ABCAttributeMapper());
mapp_logger.info("Size of the List"+l.size());
}



pom file

I have added following dependency in the pom file



<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-ldap</artifactId>
<version>1.1.2</version>
</dependency>


但是我正在追随异常。

Error Logs:
12:42:23,053 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-4) Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contextSource' defined in ServletContext resource [/WEB-INF/app-beans.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: com.sun.jndi.ldap.ctl.ResponseControlFactory from [Module "deployment.MAPP.war:main" from Service Module Loader]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965) [spring-beans-3.0.6.RELEASE.jar:3.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911) [spring-beans-3.0.6.RELEASE.jar:3.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) [spring-beans-3.0.6.RELEASE.jar:3.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.0.6.RELEASE.jar:3.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) [spring-beans-3.0.6.RELEASE.jar:3.0.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [spring-beans-3.0.6.RELEASE.jar:3.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) [spring-beans-3.0.6.RELEASE.jar:3.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192) [spring-beans-3.0.6.RELEASE.jar:3.0.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585) [spring-beans-3.0.6.RELEASE.jar:3.0.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) [spring-context-3.0.6.RELEASE.jar:3.0.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) [spring-context-3.0.6.RELEASE.jar:3.0.6.RELEASE]
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282) [spring-web-3.0.6.RELEASE.jar:3.0.6.RELEASE]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204) [spring-web-3.0.6.RELEASE.jar:3.0.6.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) [spring-web-3.0.6.RELEASE.jar:3.0.6.RELEASE]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.10.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [rt.jar:1.6.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.6.0_31]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_31]
Caused by: java.lang.NoClassDefFoundError: com.sun.jndi.ldap.ctl.ResponseControlFactory from [Module "deployment.ASSPP.war:main" from Service Module Loader]
at org.springframework.ldap.support.LdapContextSource.class$(LdapContextSource.java:42) [spring-ldap-1.1.2.jar:1.1.2]
at org.springframework.ldap.support.LdapContextSource.<clinit>(LdapContextSource.java:42) [spring-ldap-1.1.2.jar:1.1.2]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.6.0_31]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) [rt.jar:1.6.0_31]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) [rt.jar:1.6.0_31]
at java.lang.reflect.Constructor.newInstance(Unknown Source) [rt.jar:1.6.0_31]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126) [spring-beans-3.0.6.RELEASE.jar:3.0.6.RELEASE]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74) [spring-beans-3.0.6.RELEASE.jar:3.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958) [spring-beans-3.0.6.RELEASE.jar:3.0.6.RELEASE]
... 21 more


请帮助。

谢谢

最佳答案

似乎您需要ldap booster pack

关于java - 使用LdapContextSource的Spring LDAP为com.sun.jndi.ldap.ctl.ResponseControlFactory提供NoClassDefFoundError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12919693/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com