Free Support Forum - aspose.com

Bouncy Castle Exception

Hi All,


I am using Aspose Cells 8.5 jar,
Some times it throws an exception with JCE Bouncy Castle Provider Class Not found
After I searched I came to know there is a dependency with BouncyCastle
But i’m not sure about which version of Bouncycastle to use
please guide me.

Thanks
Aravinth

Hi,

Thanks for your posting and using Aspose.Cells.

Please use this one for your needs. I have attached it with this post.


You can also find it inside any .zip file of latest version e.g.
Aspose.Cells for Java 8.9.0 etc.

Thank you very much for quick reply ,


I need another help,
Do Aspose words 15.5.0 & Aspose PDF 10.4.0 also have Bouncy Castle dependency ??

Thanks ,
Aravinth

Hi Aravinth,


I have moved this thread to Aspose.Total support forum and have requested my fellow teammates to confirm the dependencies of Aspose.Words & Aspose.Pdf APIs. We will shortly get back to you with updates in this regard.

Note: I have reattached the previously shared archive here for you to download.
aravinth.thangasami:
Thank you very much for quick reply ,

I need another help,
Do Aspose words 15.5.0 & Aspose PDF 10.4.0 also have Bouncy Castle dependency ??
Hi Aravinth,

Thanks for using our API's.

Currently Aspose.Pdf for Java do not have any dependency on Bouncy Castle API but in case you encounter any issue while using our API's, please feel free to contact.

I read in forum that Aspose uses bouncy castle to encrypt the documents.

But In our case we only extract the contents from files.
So we don’t need to include bouncy castle in our path.
But it still throws NoClassDefError with Bouncy castle

what is the issue

Hi Aravinth,

aravinth.thangasami:
I read in forum that Aspose uses bouncy castle to encrypt the documents.
But In our case we only extract the contents from files.
So we don't need to include bouncy castle in our path.
But it still throws NoClassDefError with Bouncy castle

what is the issue


That is correct, the Bouncy Castle is required when you are encrypting or decrypting the spreadsheets. If you are not using any of the above mentioned features in your application, you do not need to reference the Bouncy Castle's JAR. Could you please give a try to the latest version of Aspose.Cells for Java 8.9.0.7 (attached) and see if you still experience the same problem? In case the problem persists, please share an executable sample project along with all referenced JAR files and required resources (documents) as well as your environment details so we can properly investigate the matter.

Hi,


Thanks for considering Aspose.Cells and Aspose APIs.

Please check the attached sample excel file. It’s password is 11. If you have not provided the bouncy castle i.e. bcprov-jdk16-146.jar, it will throw the following exception. But if you will add this jar in class path, then this exception will not be thrown. Some other exception might be thrown e.g. illegal key size or the code will run successfully.

However, the following exception tells that bouncy castle is missing and Aspose.Cells needs it for some sort of password protected files like those who have AES encryption but some password protected files can work directly in Aspose.Cells without the need of this jar.

I have also attached the screenshot that explains how to create such an excel file that makes Apose.Cells to require bouncy castle.

Java
LoadOptions opts = new LoadOptions();
opts.setPassword(“11”);

Workbook wb = new Workbook(dirPath + “BouncyPwd-11.xlsx”, opts);

Exception
Exception in thread “main” java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider
at com.aspose.cells.zub.a(Unknown Source)
at com.aspose.cells.zub.a(Unknown Source)
at com.aspose.cells.zti.a(Unknown Source)
at com.aspose.cells.zcam.a(Unknown Source)
at com.aspose.cells.Workbook.(Unknown Source)
at ClsAspose.f1(ClsAspose.java:34)
at ClsAspose.main(ClsAspose.java:15)
Caused by: java.lang.ClassNotFoundException: org.bouncycastle.jce.provider.BouncyCastleProvider
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 sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
… 7 more