java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider

If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.
tip

You might've forgot to add a dependency or it's written wrong. Also, you might be using incompatible versions of Java and Hibernate. More on this here: https://goo.gl/SjSlRA

tip

If you're using Hibernate, this indicates you're missing FasterXML Classmate dependency, which you can add to your dependencies. To add it, the groupId is com.fasterxml and artifactId is Classmate.

tip

Check if you didn't forget to instantiate your topic in the kafka broker.

tip

NoClassDefFoundError means java has failed to find a class you're trying to instantiate, look if you've added the class you're trying to instantiate to the dependencies.

tip

This error means there's a class missing in your classpath during runtime. You need to create a jar with all your dependencies and have it in your classpath. Check Maven Assembly Plugin and how to add your dependencies to a jar: https://goo.gl/U2zr8k

tip

jsp-api and servlet-api jars must NOT be deployed by your web app. They should be marked as provided but not deployed by your app.

tip

You need to add httpcore to your dependencies. Try adding version 4.3 or further.

tip

The server rejects all jars that already belong to the server runtime (such as tomcat-**.jar, servlet**.jar). Consider substituting the CORS filter you're using for this one: https://goo.gl/ctQ7Fs

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • All pdf files works fine. Except this one "http://www.rim.com/investors/documents/pdf/pressrelease/2011/Q1_press_release.pdf": public class PDFUtil { public static String getTransformed(InputStream inputStream) { PDDocument pdDocument = null; String document = null; try { PDFParser parser = new PDFParser(inputStream); parser.parse(); pdDocument = parser.getPDDocument(); PDFText2HTML pdf2html = new PDFText2HTML("UTF-8"); document = pdf2html.getText(pdDocument); } catch (IOException e) { e.printStackTrace(); Logger.DEBUG_MAIN.log(e.getMessage()); } finally { if (pdDocument != null) { try { pdDocument.getDocument().close(); } catch (IOException e) { e.printStackTrace(); Logger.DEBUG_MAIN.log(e.getMessage()); } } } return document; } public static void main(String[] args) throws IOException { String urlName = "http://www.rim.com/investors/documents/pdf/pressrelease/2011/Q1_press_release.pdf"; URL url = new URL(urlName); String result = getTransformed(url.openStream()); System.out.println(result); } } RETURNS: Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider at org.apache.pdfbox.pdmodel.PDDocument.openProtection(PDDocument.java:1110) at org.apache.pdfbox.pdmodel.PDDocument.decrypt(PDDocument.java:591) at org.apache.pdfbox.util.PDFTextStripper.writeText(PDFTextStripper.java:246) at org.apache.pdfbox.util.PDFTextStripper.getText(PDFTextStripper.java:184) at com.selerityfinancial.wwwscraper.utils.PDFUtil.getTransformed(PDFUtil.java:25) at com.selerityfinancial.wwwscraper.utils.PDFUtil.main(PDFUtil.java:52) Caused by: java.lang.ClassNotFoundException: org.bouncycastle.jce.provider.BouncyCastleProvider at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:303) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316) ... 6 more
    via by Vladimir,
  • All pdf files works fine. Except this one "http://www.rim.com/investors/documents/pdf/pressrelease/2011/Q1_press_release.pdf": public class PDFUtil { public static String getTransformed(InputStream inputStream) { PDDocument pdDocument = null; String document = null; try { PDFParser parser = new PDFParser(inputStream); parser.parse(); pdDocument = parser.getPDDocument(); PDFText2HTML pdf2html = new PDFText2HTML("UTF-8"); document = pdf2html.getText(pdDocument); } catch (IOException e) { e.printStackTrace(); Logger.DEBUG_MAIN.log(e.getMessage()); } finally { if (pdDocument != null) { try { pdDocument.getDocument().close(); } catch (IOException e) { e.printStackTrace(); Logger.DEBUG_MAIN.log(e.getMessage()); } } } return document; } public static void main(String[] args) throws IOException { String urlName = "http://www.rim.com/investors/documents/pdf/pressrelease/2011/Q1_press_release.pdf"; URL url = new URL(urlName); String result = getTransformed(url.openStream()); System.out.println(result); } } RETURNS: Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider at org.apache.pdfbox.pdmodel.PDDocument.openProtection(PDDocument.java:1110) at org.apache.pdfbox.pdmodel.PDDocument.decrypt(PDDocument.java:591) at org.apache.pdfbox.util.PDFTextStripper.writeText(PDFTextStripper.java:246) at org.apache.pdfbox.util.PDFTextStripper.getText(PDFTextStripper.java:184) at com.selerityfinancial.wwwscraper.utils.PDFUtil.getTransformed(PDFUtil.java:25) at com.selerityfinancial.wwwscraper.utils.PDFUtil.main(PDFUtil.java:52) Caused by: java.lang.ClassNotFoundException: org.bouncycastle.jce.provider.BouncyCastleProvider at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:303) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316) ... 6 more
    via by Vladimir,
  • ireport + netbeans | Java México
    via by Unknown author,
    • java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider at org.apache.pdfbox.pdmodel.PDDocument.openProtection(PDDocument.java:1110) at org.apache.pdfbox.pdmodel.PDDocument.decrypt(PDDocument.java:591) at org.apache.pdfbox.util.PDFTextStripper.writeText(PDFTextStripper.java:246) at org.apache.pdfbox.util.PDFTextStripper.getText(PDFTextStripper.java:184) at com.selerityfinancial.wwwscraper.utils.PDFUtil.getTransformed(PDFUtil.java:25) at com.selerityfinancial.wwwscraper.utils.PDFUtil.main(PDFUtil.java:52) Caused by: java.lang.ClassNotFoundException: org.bouncycastle.jce.provider.BouncyCastleProvider at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:303) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316) ... 6 more

    Users with the same issue

    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    1188 more bugmates