Home  >  Forum  >  Spring
Post New Query

java.lang.NoClassDefFoundError: org/bouncycastle/crypto/generators/SCrypt



Asked on January 02, 2020
Hi, I am running a simple program for scrypt encoding.

import org.springframework.security.crypto.scrypt.SCryptPasswordEncoder;
public class Test {
public static void main(String[] args) {
SCryptPasswordEncoder ob = new SCryptPasswordEncoder();
System.out.println(ob.encode("test123"));
}
}

But getting error.

Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/crypto/generators/SCrypt
at org.springframework.security.crypto.scrypt.SCryptPasswordEncoder.digest(SCryptPasswordEncoder.java:183)
at org.springframework.security.crypto.scrypt.SCryptPasswordEncoder.encode(SCryptPasswordEncoder.java:127)
at com.concretepage.Test.main(Test.java:8)
Caused by: java.lang.ClassNotFoundException: org.bouncycastle.crypto.generators.SCrypt
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 3 more


How to fix it?



Replied on January 02, 2020
Resolve bcprov-jdk15on

<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-jdk15on</artifactId>
   <version>1.64</version>
</dependency>


Write Answer




©2020 concretepage.com | Privacy Policy | Contact Us