当前位置: 首页 > 知识库问答 >
问题:

创建名为org的bean时出错。springframework。安全萨姆勒。元数据。ExtendedMetadataDelegate:无法解析匹配的构造函数

苏阳州
2023-03-14

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

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

目前,有一个bean实现了用于身份验证和授权的JdbcDaoImpl。我已经成功部署了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$1.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

扩展元数据代理构造函数采用元数据提供程序和扩展元数据,这部分配置似乎是正确的。
有什么想法吗?

共有1个答案

秦博延
2023-03-14

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

 类似资料:
  • 这是我的调度器servlet。xml 这是我的安全。xml 调试之后,我发现了一个错误 严重:加载app:java时出现异常。lang.IllegalState例外:ContainerBase。addChild:start:org。阿帕奇。卡塔琳娜。生命周期例外:组织。springframework。豆。工厂BeanCreationException:创建名为“org”的bean时出错。sprin

  • 我试图开发一个具有Spring JPA和Hibernate实现的示例Spring Boot应用程序。虽然我设法让我的安装完成,我得到以下错误,而运行的应用程序。 创建名为“org”的bean时出错。springframework。靴子自动配置。奥姆。jpa。HibernateJpacConfiguration' 我怀疑这是某种基于配置的错误,但我无法确定错误的来源。 我看到过一些有这个错误的帖子,

  • 我刚开始使用hibernate,不太确定我的应用程序出了什么问题。所以我有两个模块:核心模块和网站模块。 模块核心拥有所有的实体,daos和所有的数据库工作。所有的DAO继承一个AbstractDAO。 模块网站做所有前端的东西,如jsps,mvc控制器...它是一个支持Spring框架的maven模块。 我试图实现第二级缓存使用ehache工厂。 组织。springframework。豆。工厂B

  • 问题内容: 我有以下课程: 在我的应用程序上下文中,我有: 问题是服务器启动时出现以下错误: 看到错误,我尝试添加不同的属性,但是没有运气。我最终得到了这样的东西: 而且我仍然遇到相同的错误。 我尝试将相同的构造函数添加到子类中,并为每个子类调用适当的参数,这似乎可以解决问题。但是,我不想在所有子实例中都添加相同的构造函数,而不必使用父类维护它们。 Spring是否有某种原因无法调用继承的构造函数

  • 我有一个实体类InAppNotification。看起来像这样的java: 我使用JPA来处理数据库查询,这就是JPA接口的定义: 这是我application.properties的样子: 但是,当我试图在构建后通过运行 来打包应用程序时,我会遇到以下问题: 尝试调用不存在的方法。尝试从以下位置进行:javax.el.ELManager.getExpress sionWorks(ELManage