bazi bazi - 1 month ago 8
Java Question

Maven Assembly : NoClassDefFoundError

I am using the maven assembly plugin to build a single JAR but I'm getting this error after running the following

java -jar target/pdfbox-printing-1.0-SNAPSHOT-jar-with-dependencies.jar

the error is

Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider

this is how i compile the JAR

mvn clean compile assembly:single

here is my

<project xmlns="" xmlns:xsi=""

i am actually trying to build a project that uses apache pdfbox. and i thought the maven assembly plugin will bundle all the dependencies in one JAR but why am i getting this error if its true.


As the error reads, there is NoClassDefFoundError for org/bouncycastle/jce/provider/BouncyCastleProvider in which case you can use the maven library for the same by adding the following inside your <dependencies> :

<!-- -->

This shall help you import the package and use the Class required in your code.