Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error creating bean with name 'org.springframework.security.saml.SAMLBootstrap#0'

Tags:

spring-saml

I am adding SSO code in the webpage using SAML. And for this process I added the following code for 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>

And I added the following code in the application context xml.

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

But I get the following error

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.saml.SAMLBootstrap#0' defined in class path resource [conf/spring/root-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.saml.SAMLBootstrap]: No default constructor found; nested exception is java.lang.NoClassDefFoundError: org/springframework/beans/factory/access/BootstrapException

It appears certain jars are missing. How do I add this jar?

Thanks Jae Kim

like image 754
Jae Kim Avatar asked Feb 20 '26 04:02

Jae Kim


2 Answers

Bottom line is: update to 1.0.3.RELEASE solves the problem.

Explanation: class SAMLBootstrap throws (line 45) BootstrapException, which exists in spring-4 (spring-beans-4.2.4.RELEASE) but not in spring-5.

In spring-security-saml2-core-1.0.3.RELEASE the dependency in class BootstrapException is removed.

like image 108
OhadR Avatar answered Feb 22 '26 23:02

OhadR


According to this issue https://github.com/spring-projects/spring-security-saml/issues/211

You just have to update saml library to the latest version

1.0.4.RELEASE

like image 23
Maxim Tulupov Avatar answered Feb 22 '26 21:02

Maxim Tulupov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!