Java application not finding bouncycastle provider

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Java application not finding bouncycastle provider

This post has NOT been accepted by the mailing list yet.
I am using bouncycastle provider in a java application build using gradle.

apply plugin: 'java'
sourceCompatibility = '1.6'
version = '1.0.0'

dependencies {
    compile "org.mariadb.jdbc:mariadb-java-client:+",
    compile "org.bouncycastle:bcprov-jdk15on:+",
    compile "commons-codec:commons-codec:+",
    testCompile libraries.junit

The application builds successfully. But when I try to run the application I get the following error.

Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider
        at com.example.application.main(
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.lang.reflect.Method.invoke(
        at com.intellij.rt.execution.application.AppMain.main(
Caused by: java.lang.ClassNotFoundException: org.bouncycastle.jce.provider.BouncyCastleProvider
        at java.lang.ClassLoader.loadClass(
        at sun.misc.Launcher$AppClassLoader.loadClass(
        at java.lang.ClassLoader.loadClass(
        ... 6 more

How can I fix it ?