【问题标题】:Error creating bean with name 'org.springframework.security.saml.SAMLBootstrap#0'创建名为 'org.springframework.security.saml.SAMLBootstrap#0' 的 bean 时出错
【发布时间】:2019-05-05 09:27:45
【问题描述】:

我正在使用 SAML 在网页中添加 SSO 代码。对于这个过程,我为 Maven 添加了以下代码。

        <!-- Spring Framework Security -->
            <dependency>
          <groupId>org.springframework.security</groupId>
          <artifactId>spring-security-web</artifactId>
          <version>5.1.2.RELEASE</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-config -->
       <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>5.1.2.RELEASE</version>
       </dependency>    


        <!-- Spring Security SAML -->
        <dependency>
          <groupId>org.springframework.security.extensions</groupId>
          <artifactId>spring-security-saml2-core</artifactId>
          <version>1.0.2.RELEASE</version>
        </dependency>

我在应用程序上下文 xml 中添加了以下代码。

  <!-- Initialization of OpenSAML library -->
  <bean class="org.springframework.security.saml.SAMLBootstrap" />

但我收到以下错误

org.springframework.beans.factory.BeanCreationException: 错误 用名字创建bean 'org.springframework.security.saml.SAMLBootstrap#0' 在类中定义 路径资源[conf/spring/root-context.xml]:bean的实例化 失败的;嵌套异常是 org.springframework.beans.BeanInstantiationException:失败 实例化 [org.springframework.security.saml.SAMLBootstrap]:否 找到默认构造函数;嵌套异常是 java.lang.NoClassDefFoundError: org/springframework/beans/factory/access/BootstrapException

似乎缺少某些罐子。如何添加这个 jar?

谢谢 宰金

【问题讨论】:

    标签: spring-saml


    【解决方案1】:

    根据这个问题https://github.com/spring-projects/spring-security-saml/issues/211

    您只需将 saml 库更新到最新版本

    1.0.4.发布

    【讨论】:

    • 我尝试了 1.0.4.RELEASE 但它导致了其他问题。我通读了那篇文章,上面写着 1.0.3.RELEASE。使用 1.0.3.RELEASE 解决了这个问题。
    【解决方案2】:

    底线是:更新到 1.0.3.RELEASE 解决了问题。

    解释:class SAMLBootstrap throws (line 45) BootstrapException,存在于 spring-4 (spring-beans-4.2.4.RELEASE) 但不存在于 spring-5。

    在 spring-security-saml2-core-1.0.3.RELEASE 中,BootstrapException 类中的依赖被移除。

    【讨论】:

      猜你喜欢
      • 2016-06-29
      • 2021-12-12
      • 2016-08-09
      • 1970-01-01
      • 2013-01-11
      • 2021-11-28
      • 2020-10-03
      • 2019-08-28
      • 2015-03-18
      相关资源
      最近更新 更多