What kind of error java.lang.NoClassDefFoundError: org/bouncycastle/asn1/ASN1OctetString is this?

What kind of error java.lang.NoClassDefFoundError: org/bouncycastle/asn1/ASN1OctetString is this?

我的 Eclipse 中基于 Struts 的项目出现一些错误

java.lang.NoClassDefFoundError: org/bouncycastle/asn1/ASN1OctetString 

这是什么错误,谁能解释一下?

错误不是 org/bouncycastle/asn1/ASN1OctetString,而是 NoClassDefFoundError。这意味着在您的 CLASSPATH 中的任何目录或 jar 中都找不到 org/bouncycastle/asn1/ASN1OctetString class。来自链接文档:

Thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.

您正在查找的文件来自The Legion of the Bouncy Castle

Legion of the Bouncy Castle Java Cryptography APIs Description:

The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. The package is organised so that it contains a light-weight API suitable for use in any environment (including the newly released J2ME) with the additional infrastructure to conform the algorithms to the JCE framework.

该文件也可以从 Maven 存储库下载 here

您有错误,因为此文件在 Java 类路径中不可用。下载文件并放入WEB-INF/lib.