iText/BouncyCastle ClassNotFound org.bouncycastle.asn1.DEREncodable and org.bouncycastle.tsp.TimeStampTokenInfo

后端 未结 8 728
天命终不由人
天命终不由人 2020-11-29 06:52

I\'m trying to use iText Java. When you run the example \"how to sign\" the following error occurs:

Caused by: java.lang.ClassNotFoundException: org.bouncyca         


        
8条回答
  •  萌比男神i
    2020-11-29 07:06

    iText marks bouncycastle dependencies as optional. If you require them, you need to add the dependencies in your own pom file.

    To find out which dependency to include in your project, open the itextpdf pom.xml file of the version you are using (for example 5.3.2, here) and search for the 2 bouncycastle dependencies.

        
            org.bouncycastle
            bcprov-jdk15on
            1.47
            true
        
        
            org.bouncycastle
            bcmail-jdk15on
            1.47
            true
        
    

    Copy them into your pom file and remove the optional option.

        
            com.itextpdf
            itextpdf
            5.3.2
        
        
            org.bouncycastle
            bcprov-jdk15on
            1.47
        
        
            org.bouncycastle
            bcmail-jdk15on
            1.47
        
    

提交回复
热议问题