3

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

Jae Kim
  • 137
  • 1
  • 2
  • 6

2 Answers2

2

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.

OhadR
  • 8,276
  • 3
  • 47
  • 53
1

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

Maxim Tulupov
  • 1,621
  • 13
  • 8
  • 2
    I tried 1.0.4.RELEASE but it caused other problems. I read through that article and it says 1.0.3.RELEASE. Using 1.0.3.RELEASE solved the problem. – Jae Kim Dec 04 '18 at 05:06