class file for org.bouncycastle.cert.ocsp.BasicOCS

2019-09-10 04:15发布

问题:

I made the mistake of running clean on my Netbeans project, which has had no major API changes at all lately. Now the build suddenly fails with the following error: class file for org.bouncycastle.cert.ocsp.BasicOCSPResp not found

To my knowledge, I'm not using any such library in my project. I did find that it is an iText dependency of some sort, but even when I comment out all of my iText-related code, the error persists.

I have tried adding the 1.49 version of bouncycastle to my Netbeans project, to no avail. (Actually, that did cure the first bouncycastle no-class-found error I had, but this second error was the next problem). I looked in the archive and found that BasicOCSPResp is found under org.bouncycastle.ocsp. I also tried peeking at versions 1.47, 1.46, and even 1.32 and found BasicOCSPResp under org.bouncycastle.ocsp and not org.bouncycastle.cert.ocsp in all of them.

Here is the build stacktrace: Note: Creating static metadata factory ...

error: com.sun.tools.javac.code.Symbol$CompletionFailure: class file for      
org.bouncycastle.cert.ocsp.BasicOCSPResp not found

An annotation processor threw an uncaught exception. Consult the following stack trace for details.

java.lang.RuntimeException: com.sun.tools.javac.code.Symbol$CompletionFailure: class file for org.bouncycastle.cert.ocsp.BasicOCSPResp not found
at org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:407)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:627)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:556)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:701)

回答1:

Bouncy Castle has classes in several jars. For BasicOCSPResp you need to make sure a bcpkix jar is on the classpath. The latest version is bcpkix-jdk15on-149.jar.