创建名称为 org.springframework.security.saml.metadata.ExtendedMetadataDelegate 的 bean 时出错:无法解析匹配的构造函数

Error creating bean with name org.springframework.security.saml.metadata.ExtendedMetadataDelegate: Could not resolve matching constructor

我必须为客户集成 Shibboleth SP 身份验证,我需要将它与我在 JBoss AS 7 上的 J2EE 应用程序(JSF2、EJB3、JPA2)集成。
我正在使用这个库:

  1. spring-security-core-3.2.5 和依赖项
  2. spring-security-saml2-core-1.0.0 和依赖项
  3. spring 框架 4.1.3

目前有一个实现 JdbcDaoImpl 用于身份验证和授权的 bean。我已成功部署 Spring SAML 示例应用程序,但无法将其集成到我的应用程序中。我在部署期间收到异常,似乎无法构造 ExtendedMetadataDelegate bean,其定义如下:

<beans:bean id="metadata" class="org.springframework.security.saml.metadata.CachingMetadataManager">
    <beans:constructor-arg>
        <beans:list>
            <!-- Example of classpath metadata with Extended Metadata -->
            <beans:bean class="org.springframework.security.saml.metadata.ExtendedMetadataDelegate">
                <beans:constructor-arg>
                    <beans:bean class="org.opensaml.saml2.metadata.provider.ResourceBackedMetadataProvider">
                        <beans:constructor-arg>
                            <beans:bean class="java.util.Timer"/>
                        </beans:constructor-arg>
                        <beans:constructor-arg>
                            <beans:bean class="org.opensaml.util.resource.ClasspathResource">
                                <beans:constructor-arg value="/CustomerIDPMetadata.xml"/>
                            </beans:bean>
                        </beans:constructor-arg>
                        <beans:property name="parserPool" ref="parserPool"/>
                    </beans:bean>
                </beans:constructor-arg>
                <beans:constructor-arg>
                    <beans:bean class="org.springframework.security.saml.metadata.ExtendedMetadata"></beans:bean>
                </beans:constructor-arg>
            </beans:bean>
            <!-- Example of HTTP metadata without Extended Metadata -->
            <beans:bean class="org.opensaml.saml2.metadata.provider.HTTPMetadataProvider">
                <!-- URL containing the metadata -->
                <beans:constructor-arg>
                    <beans:value type="java.lang.String">https://customer/Metadata/Metadata.xml</beans:value>
                </beans:constructor-arg>
                <!-- Timeout for metadata loading in ms -->
                <beans:constructor-arg>
                    <beans:value type="int">15000</beans:value>
                </beans:constructor-arg>
                <beans:property name="parserPool" ref="parserPool"/>
            </beans:bean>
            <!-- Example of file system metadata without Extended Metadata -->
            <!--
            <bean class="org.opensaml.saml2.metadata.provider.FilesystemMetadataProvider">
                <constructor-arg>
                    <value type="java.io.File">/usr/local/metadata/idp.xml</value>
                </constructor-arg>
                <property name="parserPool" ref="parserPool"/>
            </bean>
            -->
        </beans:list>
    </beans:constructor-arg>
    <!-- OPTIONAL used when one of the metadata files contains information about this service provider -->
    <!-- <property name="hostedSPName" value=""/> -->
    <!-- OPTIONAL property: can tell the system which IDP should be used for authenticating user by default. -->
    <!-- <property name="defaultIDP" value="http://localhost:8080/opensso"/> -->
</beans:bean>    

堆栈跟踪:

  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#0': Cannot resolve reference to bean 'metadataGeneratorFilter' while setting constructor argument with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metadataGeneratorFilter' defined in ServletContext resource [/WEB-INF/security-app-context.xml]: Cannot create inner bean 'org.springframework.security.saml.metadata.MetadataGenerator#115824e4' of type [org.springframework.security.saml.metadata.MetadataGenerator] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.saml.metadata.MetadataGenerator#115824e4': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.saml.metadata.MetadataGenerator.setSamlWebSSOFilter(org.springframework.security.saml.SAMLProcessingFilter); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'samlWebSSOProcessingFilter': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.saml.SAMLProcessingFilter.setContextProvider(org.springframework.security.saml.context.SAMLContextProvider); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contextProvider': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.saml.context.SAMLContextProviderImpl.setMetadata(org.springframework.security.saml.metadata.MetadataManager); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metadata' defined in ServletContext resource [/WEB-INF/security-app-context.xml]: Cannot create inner bean 'org.springframework.security.saml.metadata.ExtendedMetadataDelegate#7a0347fc' of type [org.springframework.security.saml.metadata.ExtendedMetadataDelegate] while setting constructor argument with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.saml.metadata.ExtendedMetadataDelegate#7a0347fc' defined in ServletContext resource [/WEB-INF/security-app-context.xml]: Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359) [spring-beans-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108) [spring-beans-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:382) [spring-beans-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:157) [spring-beans-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:637) [spring-beans-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:140) [spring-beans-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1131) [spring-beans-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1034) [spring-beans-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) [spring-beans-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) [spring-beans-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:302) [spring-beans-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) [spring-beans-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) [spring-beans-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) [spring-beans-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351) [spring-beans-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    ... 25 more

ExtendedMetadataDelegate 构造函数采用 MetadataProvider 和 ExtendedMetadata,这部分配置似乎是正确的。
有什么想法吗?

已解决。在 Eclipse 中,我在部署部分为 Web 项目指定导出所有 spring-saml-sample jar。