Spring LDA: problem with contextSource Bean

I am writing a Spring application that uses LDAP. Here is my beans file.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

   <bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource">
      <property name="url" value="xxxxx:xxx" />
      <property name="base" value="ou=xxxxx,dc=xxxxxxx,dc=xxxxxx" />
      <property name="userDn" value="uid=xxxxxxx" />
      <property name="password" value="xxxxxxxx" />
   </bean>

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

   <bean id="helloLdap" class="a.b.c.HelloLdap">
      <property name="ldapTemplate" ref="ldapTemplate" />
   </bean>

</beans>

Here is my beans creation code:

ApplicationContext fac = new ClassPathXmlApplicationContext(
                "a/b/c/ldap.xml");
HelloLdap hello = (HelloLdap) fac.getBean("helloLdap");

Here is my error message:

An exception in the stream "main" org.springframework.beans.factory.BeanCreationException: an error occurred while creating a bean with the name "contextSource" defined in the key path resource [xxxxxxxxxxxx]: error property values; The nested exception is org.springframework.beans.PropertyBatchUpdateException; Nested properties PropertyAccessExceptions (1): PropertyAccessException 1: org.springframework.beans.MethodInvocationException: the base property threw an exception; The nested exception is java.lang.NoClassDefFoundError: org / apache / commons / lang / StringUtils

So he says (most important)

"Property 'base' threw exception". 

, , StartTLS. StartTLS beans, , , . , , beans, .

- , ( StartTLS)? , , XML?

,

+3
1

:

java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils

- Apache Commons Lang. , .

+5

Source: https://habr.com/ru/post/1786755/


All Articles