ClassNotFoundException BouncyCastleProvider exception

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Viewer MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-viewer -- dnx GroupDocs.Viewer.Mcp --yes
Folders, licensing and more →

GroupDocs.Viewer for Java API depends on Bouncy Castle for encryption and decryption features, that is; if the program is required to load or save encrypted spreadsheets, it is required to add reference of bcprov-jdk16-1.46.jar in the project’s class path.

Symptoms

You may get exception like java.lang.ClassNotFoundException: org.bouncycastle.jce.provider.BouncyCastleProvider.

Solution

The solution is actually very simple as detailed below.

  • Download bcprov-jdk16-1.46.jar library as JAR file from Maven repository.
  • Put the file into your project directory.
  • Reference the bcprov-jdk16-1.46.jar in the class path of the project.

Alternatively, you can add the dependency in the pom.xml and let the project resolve the dependency via maven.

<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-jdk16</artifactId>
    <version>1.46</version>
</dependency>