Java 在CAS 4.2.x中找不到ldaptive架构

Java 在CAS 4.2.x中找不到ldaptive架构,java,spring,spring-mvc,cas,Java,Spring,Spring Mvc,Cas,我不熟悉CAS设置,开始使用CAS 4.2.x版本。在下面的帮助下,执行设置。 [ 在deployerConfigcontext.xml中添加bean引用“”后,获取错误 配置问题:找不到xml架构命名空间的Spring命名空间处理程序[http://www.ldaptive.org/schema/spring-ext] <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://w

我不熟悉CAS设置,开始使用CAS 4.2.x版本。在下面的帮助下,执行设置。 [

在deployerConfigcontext.xml中添加bean引用“”后,获取错误

配置问题:找不到xml架构命名空间的Spring命名空间处理程序[http://www.ldaptive.org/schema/spring-ext]

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:webflow="http://www.springframework.org/schema/webflow-config"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:c="http://www.springframework.org/schema/c"
       xmlns:util="http://www.springframework.org/schema/util"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:ldaptive="http://www.ldaptive.org/schema/spring-ext"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
       http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/webflow-config http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd
        http://www.ldaptive.org/schema/spring-ext http://www.ldaptive.org/schema/spring-ext.xsd">

我正在使用CAS 3.5.2,并且面临着相同的问题……下面的解决方法对我很有效。您可以尝试一下,看看它是否也对您有效

在pom.xml文件中添加以下依赖项

    <dependency>
         <groupId>org.jasig.cas</groupId>
         <artifactId>cas-server-support-ldap</artifactId>
         <version>${cas.version}</version>
    </dependency>
在deployerConfigcontext.xml中,删除ldaptive声明,并将其替换为以下格式

<bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource">
              <!-- DO NOT enable JNDI pooling for context sources that perform LDAP bind operations. -->
              <property name="pooled" value="false"/>

              <!--
                Although multiple URLs may defined, it's strongly recommended to avoid this configuration
                since the implementation attempts hosts in sequence and requires a connection timeout
                prior to attempting the next host, which incurs unacceptable latency on node failure.
                A proper HA setup for LDAP directories should use a single virtual host that maps to multiple
                real hosts using a hardware load balancer.
              -->
              <property name="url" value="your-ldap-url" />

              <!--
                Manager credentials are only required if your directory does not support anonymous searches.
                Never provide these credentials for FastBindLdapAuthenticationHandler since the user's
                credentials are used for the bind operation.
              -->
              <property name="userDn" value="your-userDn-info"/>
              <property name="password" value="password-for-your-userDn"/>

              <!-- Place JNDI environment properties here. -->
              <property name="baseEnvironmentProperties">
                <map>
                  <!-- Three seconds is an eternity to users. -->
                  <entry key="com.sun.jndi.ldap.connect.timeout" value="3000" />
                  <entry key="com.sun.jndi.ldap.read.timeout" value="3000" />

                  <!-- Explained at http://docs.oracle.com/javase/jndi/tutorial/ldap/security/auth.html -->
                  <entry key="java.naming.security.authentication" value="simple" />
                </map>
              </property>
            </bean>

另外,在deployerConfigcontext.xml中,删除ldapAuthenticationHandler bean,并将其替换为以下内容

<bean class="org.jasig.cas.adaptors.ldap.BindLdapAuthenticationHandler"
              p:filter="your-ldap-filter"
              p:searchBase="your-search-base"
              p:contextSource-ref="contextSource"
              p:ignorePartialResultException="true" />

请注意,我正在使用CAS 3.5.2,因此您可能需要进行更多更改

<bean class="org.jasig.cas.adaptors.ldap.BindLdapAuthenticationHandler"
              p:filter="your-ldap-filter"
              p:searchBase="your-search-base"
              p:contextSource-ref="contextSource"
              p:ignorePartialResultException="true" />