SecurityException for class org.bouncycastle.jcajce.provider.asymmetric.DSTU4145$Mappings

Viewed 1754

I am using Spring boot version 2.1.11.After adding the spring-security-oauth2-autoconfigure in my pom.xml.I am getting the following error while running the application.

 "java.lang.SecurityException: class "org.bouncycastle.jcajce.provider.asymmetric.DSTU4145$Mappings"'s signer information does not match signer information of other classes in the same package"
1 Answers

It is because of some jar version incompatibility in the libraries to load, aka. jar-hell. Try to exclude the group org.bouncycastle. You can specify the version also: bcprov-jdk16

For gradle:

implementation(group: 'aaa', name: 'bbb', version: '1.0.0') {
  exclude group: 'org.bouncycastle'
}

For maven:

<dependency>
        <groupId>aaa</groupId>
        <artifactId>bbb</artifactId>
        <version>1.0.0</version>
        <exclusions>
            <exclusion>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcprov-jdk16</artifactId>
            </exclusion>
        </exclusions>
</dependency>
Related