尝试创建小型jasper报告时出错

时间:2015-10-28 06:29:03

标签: java jasper-reports noclassdeffounderror

我已将Jasperstudio 6.1.1插件包含在我的日食中。我已将以下罐子包含在我的库中。

  • 的JasperReports-6.1.1
  • 公地BeanUtils的-1.8.0
  • 公地集合-2.1
  • 公地消化器-1.7
  • 公地洛-API-1.0.2
  • Groovy的全1.7.5
  • 的iText-4.2.0
  • ojdbc6

当我尝试执行一个独立的java类时,我得到了跟随错误。我认为错误是因为我的公共版本,但不知道如何找到确切的版本。

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections/map/ReferenceMap
    at net.sf.jasperreports.engine.design.JRAbstractJavaCompiler.<clinit>(JRAbstractJavaCompiler.java:74)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at net.sf.jasperreports.engine.JasperCompileManager.getCompiler(JasperCompileManager.java:823)
    at net.sf.jasperreports.engine.JasperCompileManager.getEvaluator(JasperCompileManager.java:380)
    at net.sf.jasperreports.engine.fill.JRFillDataset.createCalculator(JRFillDataset.java:467)
    at net.sf.jasperreports.engine.fill.BaseReportFiller.<init>(BaseReportFiller.java:152)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:236)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:72)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:60)
    at net.sf.jasperreports.engine.fill.JRFiller.createBandReportFiller(JRFiller.java:201)
    at net.sf.jasperreports.engine.fill.JRFiller.createReportFiller(JRFiller.java:216)
    at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:85)
    at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:456)
    at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:417)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:838)
    at id.hans.employee.application.MainApplication.showReport(MainApplication.java:59)
    at id.hans.employee.application.MainApplication.main(MainApplication.java:83)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections.map.ReferenceMap
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 20 more

1 个答案:

答案 0 :(得分:1)

我刚刚找到解决方案。问题出在commons-collect版本上。我把它升级到commons-collection-3.2.1.jar并且它有效。感谢