Your ldap DAO is missing both the search filter and the load filter and they 
should be automatically set by the code.



Try adding:

<context:component-scan base-package="org.jasig.cas" />



To your configuration.



From: David A. Kovacic [mailto:d...@case.edu]
Sent: Monday, August 4, 2014 10:32 AM
To: cas-user@lists.jasig.org
Subject: [cas-user] Issues with deploying LDAP-based Service Registry 
(4.0.0)



We have been trying to get the LDAP service registry running on CAS 4.0.0 by 
fleshing out the beans given in the 4.0.0 documentation.  Essentially what 
we've done is create the pooledLdapConnectionFactory and searchRequest 
properties using our LDAP authentication setup as a template.  The 
ldapServiceMapper property does not appear to require more configuration (at 
least when using the default LDAP attribute names) than is given in the 
documentation (note that I've only pulled the pertinent pieces of the 
deployerConfigContext.xml file below to help keep the size of this down to 
something reasonable).  The abstractConnectionPool stuff is shared between 
the service registry and the authentication pieces.  This is what our 
deployerConfigContext.xml file looks like:

    <bean id="serviceRegistryDao"
          class="org.jasig.cas.adaptors.ldap.services.LdapServiceRegistryDao"
          p:connectionFactory-ref="servicePooledLdapConnectionFactory"
          p:searchRequest-ref="searchRequest"
          p:ldapServiceMapper-ref="ldapMapper" />

    <bean id="servicePooledLdapConnectionFactory"
          class="org.ldaptive.pool.PooledConnectionFactory"
          p:connectionPool-ref="serviceConnectionPool" />

    <bean id="serviceConnectionPool" parent="abstractConnectionPool"
          p:connectionFactory-ref="serviceConnectionFactory" />

     <bean id="abstractConnectionPool" abstract="true"
          class="org.ldaptive.pool.BlockingConnectionPool"
          init-method="initialize"
          p:poolConfig-ref="ldapPoolConfig"
          p:blockWaitTime="${ldap.pool.blockWaitTime}"
          p:validator-ref="searchValidator"
          p:pruneStrategy-ref="pruneStrategy" />

    <bean id="abstractConnectionConfig" abstract="true"
          class="org.ldaptive.ConnectionConfig"
          p:ldapUrl="${ldap.url}"
          p:connectTimeout="${ldap.connectTimeout}"
          p:useStartTLS="${ldap.useStartTLS}"
          p:sslConfig-ref="sslConfig" />

    <bean id="ldapPoolConfig" class="org.ldaptive.pool.PoolConfig"
          p:minPoolSize="${ldap.pool.minSize}"
          p:maxPoolSize="${ldap.pool.maxSize}"
          p:validateOnCheckOut="${ldap.pool.validateOnCheckout}"
          p:validatePeriodically="${ldap.pool.validatePeriodically}"
          p:validatePeriod="${ldap.pool.validatePeriod}" />

    <bean id="sslConfig" class="org.ldaptive.ssl.SslConfig">
        <property name="credentialConfig">
            <bean class="org.ldaptive.ssl.X509CredentialConfig"
                  p:trustCertificates="${ldap.trustedCert}" />
        </property>
    </bean>

    <bean id="pruneStrategy" class="org.ldaptive.pool.IdlePruneStrategy"
          p:prunePeriod="${ldap.pool.prunePeriod}"
          p:idleTime="${ldap.pool.idleTime}" />

    <bean id="searchValidator" class="org.ldaptive.pool.SearchValidator" />
   <bean id="serviceConnectionFactory"
          class="org.ldaptive.DefaultConnectionFactory"
          p:connectionConfig-ref="serviceConnectionConfig" />

    <bean id="serviceConnectionConfig" parent="svcAbstractConnectionConfig"
          p:connectionInitializer-ref="serviceConnectionInitializer" />

    <bean id="svcAbstractConnectionConfig" abstract="true"
          class="org.ldaptive.ConnectionConfig"
          p:ldapUrl="${ldap.service.url}"
          p:connectTimeout="${ldap.connectTimeout}"
          p:useStartTLS="${ldap.useStartTLS}"
          p:sslConfig-ref="sslConfig" />

    <bean id="serviceConnectionInitializer"
          class="org.ldaptive.BindConnectionInitializer"
          p:bindDn="${ldap.service.managerDn}">
        <property name="bindCredential">
            <bean class="org.ldaptive.Credential"
                  c:password="${ldap.service.managerPassword}" />
        </property>
    </bean>

    <bean id="searchRequest"
          class="org.ldaptive.SearchRequest"
          p:baseDn="${ldap.service.baseDn}"
          p:searchFilter="${ldap.service.searchFilter}" />

    <bean id="ldapMapper"
          
class="org.jasig.cas.adaptors.ldap.services.DefaultLdapServiceMapper"/>


Maven builds the package with no errors, but when we go to start up Tomcat 
this is what we see:

INFO: Starting Servlet Engine: Apache Tomcat/7.0.54
Aug 04, 2014 1:06:50 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive 
/opt/apache-tomcat-7.0.54/webapps/cas.war
2014-08-04 13:06:57,222 ERROR 
[org.springframework.web.context.ContextLoader] - <Context initialization 
failed>
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'servicesManager' defined in ServletContext resource 
[/WEB-INF/spring-configuration/applicationContext.xml]: Cannot resolve 
reference to bean 'serviceRegistryDao' while setting constructor argument; 
nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'serviceRegistryDao' defined in ServletContext 
resource [/WEB-INF/deployerConfigContext.xml]: Initialization of bean 
failed; nested exception is 
org.springframework.beans.factory.BeanInitializationException: Bean state is 
invalid: searchFilter - may not be null; loadFilter - may not be null
    at 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:326)
    at 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107)
    at 
org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:637)
    at 
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1075)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:979)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
    at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
    at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)
    at 
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
    at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    at 
org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
    at 
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
    at 
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
    at 
org.jasig.cas.web.init.SafeContextLoaderListener.contextInitialized(SafeContextLoaderListener.java:75)
    at 
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
    at 
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
    at 
org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083)
    at 
org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1880)
    at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'serviceRegistryDao' defined in ServletContext 
resource [/WEB-INF/deployerConfigContext.xml]: Initialization of bean 
failed; nested exception is 
org.springframework.beans.factory.BeanInitializationException: Bean state is 
invalid: searchFilter - may not be null; loadFilter - may not be null
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:529)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
    at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
    at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:320)
    ... 31 more
Caused by: org.springframework.beans.factory.BeanInitializationException: 
Bean state is invalid: searchFilter - may not be null; loadFilter - may not 
be null
    at 
org.springframework.validation.beanvalidation.BeanValidationPostProcessor.doValidate(BeanValidationPostProcessor.java:113)
    at 
org.springframework.validation.beanvalidation.BeanValidationPostProcessor.postProcessAfterInitialization(BeanValidationPostProcessor.java:91)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:409)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1518)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
    ... 37 more
2014-08-04 13:06:57,231 ERROR 
[org.jasig.cas.web.init.SafeContextLoaderListener] - 
<SafeContextLoaderListener:
The Spring ContextLoaderListener we wrap threw on contextInitialized.
But for our having caught this error, the web application context would not 
have initialized.>
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'servicesManager' defined in ServletContext resource 
[/WEB-INF/spring-configuration/applicationContext.xml]: Cannot resolve 
reference to bean 'serviceRegistryDao' while setting constructor argument; 
nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'serviceRegistryDao' defined in ServletContext 
resource [/WEB-INF/deployerConfigContext.xml]: Initialization of bean 
failed; nested exception is 
org.springframework.beans.factory.BeanInitializationException: Bean state is 
invalid: searchFilter - may not be null; loadFilter - may not be null
    at 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:326)
    at 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107)
    at 
org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:637)
    at 
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1075)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:979)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
    at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
    at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)
    at 
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
    at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    at 
org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
    at 
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
    at 
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
    at 
org.jasig.cas.web.init.SafeContextLoaderListener.contextInitialized(SafeContextLoaderListener.java:75)
    at 
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
    at 
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
    at 
org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083)
    at 
org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1880)
    at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'serviceRegistryDao' defined in ServletContext 
resource [/WEB-INF/deployerConfigContext.xml]: Initialization of bean 
failed; nested exception is 
org.springframework.beans.factory.BeanInitializationException: Bean state is 
invalid: searchFilter - may not be null; loadFilter - may not be null
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:529)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
    at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
    at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:320)
    ... 31 more
Caused by: org.springframework.beans.factory.BeanInitializationException: 
Bean state is invalid: searchFilter - may not be null; loadFilter - may not 
be null
    at 
org.springframework.validation.beanvalidation.BeanValidationPostProcessor.doValidate(BeanValidationPostProcessor.java:113)
    at 
org.springframework.validation.beanvalidation.BeanValidationPostProcessor.postProcessAfterInitialization(BeanValidationPostProcessor.java:91)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:409)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1518)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
    ... 37 more
Aug 04, 2014 1:06:57 PM org.apache.catalina.core.StandardContext 
startInternal
SEVERE: Error filterStart
Aug 04, 2014 1:06:57 PM org.apache.catalina.core.StandardContext 
startInternal
SEVERE: Context [/cas] startup failed due to previous errors

as far as we can tell, there are no missing dependencies since Maven builds 
the project without error.

If anyone who has gotten this working (under 3.5.2 or 4.0.0) can give us 
some pointers on what we are missing, we would appreciate it.


-- 
You are currently subscribed to cas-user@lists.jasig.org 
<mailto:cas-user@lists.jasig.org>  as: mmoay...@unicon.net 
<mailto:mmoay...@unicon.net>
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

-- 
You are currently subscribed to cas-user@lists.jasig.org as: 
arch...@mail-archive.com
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

Reply via email to