#java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28541962/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 06:22:57  来源:igfitidea点击:

#java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester

javajasper-reportsclasspathnoclassdeffounderror

提问by sharath Yogananda

I am getting java.lang.NoClassDefFoundError: org/apache/commons/digester/Digestererror and I am stuck with this error for more than a month. I have tried all Digester versions available and I also checked for duplicate JARs in classpath.

我收到 java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester错误,并且我被这个错误困扰了一个多月。我已经尝试了所有可用的 Digester 版本,我还在类路径中检查了重复的 JAR。

I have designed the report through iReport-5.6.0and I used the JARs from the iReport-5.6.0\ireport\modules\extand other required JARs.

我已经设计了报告iReport-5.6.0并使用了来自 iReport-5.6.0\ireport\modules\ext和其他所需 JAR 的 JAR。

Error-Log:

错误日志:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester
    at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:108)
    at net.sf.dynamicreports.examples.JasperMongoDBConnection.main(JasperMongoDBConnection.java:30)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.digester.Digester
    at java.net.URLClassLoader.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at sun.misc.Launcher$ExtClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 2 more

采纳答案by exoddus

If NoClassDefFoundErroris thrown you should check that needed jars are properly loaded in the classpath, or maybe you are mixing versions and class names may be different (or it's behavior). Check if the Digester jar you are adding is the one that is needed.

如果NoClassDefFoundError被抛出,您应该检查所需的 jars 是否正确加载到类路径中,或者您可能正在混合版本和类名可能不同(或者它的行为)。检查您添加的消化罐是否是所需的罐。

Check if these jar are correctly loaded:

检查这些 jar 是否正确加载:

jasperreports-.jar;
jasperreports-javaflow.jar;
commons-beanutils.jar;
commons-collections.jar;
commons-logging.jar;
commons-digester.jar

Take a look on jasper report plugin folder under your eclipse instance. Search for the commons digester jar inside this folder and copy the same jar (and the other of listed jars) in your project.

查看 Eclipse 实例下的 jasper 报告插件文件夹。在此文件夹中搜索 commons digester jar 并在您的项目中复制相同的 jar(和其他列出的 jar)。