从DB

时间:2016-10-11 13:40:46

标签: jdbc cas

我在casv 4.2.5部署了tomcat 8。登录效果很好。在第二步中,我尝试了3天后从数据库访问用户属性。通过启动tomcat,我收到了错误:

  

org.springframework.beans.factory.BeanCreationException:错误   用名称' personDirectoryPrincipalResolver':注入创建bean   自动连接的依赖关系失败;嵌套异常是   org.springframework.beans.factory.BeanCreationException:不能   autowire方法:public final void   org.jasig.cas.authentication.principal.PersonDirectoryPrincipalResolver.setAttributeRepository(org.jasig.services.persondir.IPersonAttributeDao);   嵌套异常是   org.springframework.beans.factory.NoSuchBeanDefinitionException:没有   合格的bean类型   找到[org.jasig.services.persondir.IPersonAttributeDao]   依赖:预计至少有1个bean有资格成为autowire   这种依赖的候选人。依赖注释:   {@ org.springframework.beans.factory.annotation.Qualifier(值= attributeRepository)} ...

这是我的deployerConfigContext.xml文件

                 

</util:map>
<util:map id="authenticationHandlersResolvers">
    <entry key-ref="proxyAuthenticationHandler" value-ref="proxyPrincipalResolver" />
    <entry key-ref="primaryAuthenticationHandler" value-ref="primaryPrincipalResolver" />


</util:map>


<util:list id="authenticationMetadataPopulators">
    <ref bean="successfulHandlerMetaDataPopulator" />
    <ref bean="rememberMeAuthenticationMetaDataPopulator" />
</util:list>

<bean id="primaryPrincipalResolver"
    class="org.jasig.cas.authentication.principal.PersonDirectoryPrincipalResolver">
    <property name="attributeRepository" ref="singleRowJdbcPersonAttributeDao" />
</bean>

<!-- <bean id="attributeRepository" class="org.jasig.services.persondir.support.NamedStubPersonAttributeDao" 
    p:backingMap-ref="attrRepoBackingMap" /> -->

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
    p:driverClass="${database.driverClass}" p:jdbcUrl="${database.url}"
    p:user="${database.user}" p:password="${database.password}"
    p:initialPoolSize="${database.pool.minSize}" p:minPoolSize="${database.pool.minSize}"
    p:maxPoolSize="${database.pool.maxSize}"
    p:maxIdleTimeExcessConnections="${database.pool.maxIdleTime}"
    p:checkoutTimeout="${database.pool.maxWait}" p:acquireIncrement="${database.pool.acquireIncrement}"
    p:acquireRetryAttempts="${database.pool.acquireRetryAttempts}"
    p:acquireRetryDelay="${database.pool.acquireRetryDelay}"
    p:idleConnectionTestPeriod="${database.pool.idleConnectionTestPeriod}"
    p:preferredTestQuery="${database.pool.connectionHealthQuery}" />


<bean id="singleRowJdbcPersonAttributeDao"
    class="org.jasig.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao">
    <constructor-arg index="0" ref="dataSource" />
    <constructor-arg index="1"
        value="SELECT * FROM VIEWNUTZ_ROLLE WHERE {0}" />
    <property name="queryAttributeMapping">
        <map>
            <entry key="username" value="EMAIL" />
        </map>
    </property>
    <property name="resultAttributeMapping">
        <map>
            <entry key="NUZ_ID" value="nuz_id" />
            <entry key="EMAIL" value="username" />
            <entry key="ROLLE" value="rolle" />
        </map>
    </property>
</bean>



<bean id="serviceRegistryDao" class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl">
    <property name="registeredServices">
        <list>
            <bean class="org.jasig.cas.services.RegisteredServiceImpl">
                <property name="id" value="0" />
                <property name="name" value="HTTPS Services" />
                <property name="description" value="YOUR HTTP Service" />
                <property name="serviceId" value="https://**" />
                <property name="allowedAttributes">
                    <list>
                        <value>NUZ_ID</value>
                        <value>EMAIL</value>
                        <value>ROLLE</value>

                    </list>
                </property>
            </bean>
        </list>
    </property>
</bean>


<alias name="queryDatabaseAuthenticationHandler" alias="primaryAuthenticationHandler" />
<alias name="dataSource" alias="queryDatabaseDataSource" />

<!-- -->

<bean id="passwordEncoder"
    class="de.nrw.it.portal.dias.cas.authentication.handler.Base64PasswordEncoder" />


<!-- <bean id="iPersonAttributeDao" class="org.jasig.services.persondir.IPersonAttributeDao" 
    /> -->

<alias name="personDirectoryPrincipalResolver" alias="primaryPrincipalResolver" />

<!-- <util:map id="attrRepoBackingMap"> <entry key="uid" value="uid" /> 
    <entry key="eduPersonAffiliation" value="eduPersonAffiliation" /> <entry 
    key="groupMembership" value="groupMembership" /> <entry> <key> <value>memberOf</value> 
    </key> <list> <value>faculty</value> <value>staff</value> <value>org</value> 
    </list> </entry> </util:map> -->

<alias name="serviceThemeResolver" alias="themeResolver" />

<alias name="jsonServiceRegistryDao" alias="serviceRegistryDao" />

<alias name="defaultTicketRegistry" alias="ticketRegistry" />

<alias name="ticketGrantingTicketExpirationPolicy" alias="grantingTicketExpirationPolicy" />
<alias name="multiTimeUseOrTimeoutExpirationPolicy" alias="serviceTicketExpirationPolicy" />

<alias name="anyAuthenticationPolicy" alias="authenticationPolicy" />
<alias name="acceptAnyAuthenticationPolicyFactory" alias="authenticationPolicyFactory" />

<bean id="auditTrailManager"
    class="org.jasig.inspektr.audit.support.Slf4jLoggingAuditTrailManager"
    p:entrySeparator="${cas.audit.singleline.separator:|}"
    p:useSingleLine="${cas.audit.singleline:false}" />

<alias name="neverThrottle" alias="authenticationThrottle" />

<util:list id="monitorsList">
    <ref bean="memoryMonitor" />
    <ref bean="sessionMonitor" />
</util:list>

<alias name="defaultPrincipalFactory" alias="principalFactory" />
<alias name="defaultAuthenticationTransactionManager" alias="authenticationTransactionManager" />
<alias name="defaultPrincipalElectionStrategy" alias="principalElectionStrategy" />
<alias name="tgcCipherExecutor" alias="defaultCookieCipherExecutor" />

我在cas.properties文件中的

cas.principal.resolver.persondir.return.null=false

如果您有如何配置cas的想法或示例,我将非常感谢:)

1 个答案:

答案 0 :(得分:0)

Spring容器找不到类型&#39; org.jasig.services.persondir.IPersonAttributeDao&#39;的bean。取消注释bean的声明&#; iPersonAttributeDao&#39;在您的配置文件中。