Question

I am using IText 4.2.0 and bcprov-jdk15-1.43.jar and bctsp-jdk15-1.43.jar for signing pdf. I added these jars by add external jars button in Eclipse. When I execute it gives me following error.

ExceptionConverter: java.lang.Exception: Failed to get TSA response from tsaURL
at com.lowagie.text.pdf.TSAClientBouncyCastle.getTimeStampToken(TSAClientBouncyCastle.java:185)
at com.lowagie.text.pdf.TSAClientBouncyCastle.getTimeStampToken(TSAClientBouncyCastle.java:136)
at com.lowagie.text.pdf.PdfPKCS7.getEncodedPKCS7(PdfPKCS7.java:1236)
at pack1.PDFSigningWithHSM.PDFSigningWithHSM.main(PDFSigningWithHSM.java:489)

Caused by: java.lang.NoClassDefFoundError: org/bouncycastle/asn1/ASN1Encodable
at com.lowagie.text.pdf.TSAClientBouncyCastle.getTimeStampToken(TSAClientBouncyCastle.java:146)
... 3 more

Caused by: java.lang.ClassNotFoundException: org.bouncycastle.asn1.ASN1Encodable
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 4 more

But I see Class ASN1Encodable in the jar file bcprov-jdk15-1.43.jar. I dont understand what is the problem.

Was it helpful?

Solution

That exception means that the classloader cannot find that class at runtime. We don't have enough information to determine why it is the case ... but it is definitely the cause of your problems.

Check that the offending JAR file is actually on your application's effective runtime classpath.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top