Jasper报告在netbeans中运行良好,但在部署为jar应用程序时会出现异常 [英] Jasper report working fine in netbeans but gives exception when deployed as jar application

查看:137
本文介绍了Jasper报告在netbeans中运行良好,但在部署为jar应用程序时会出现异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用java swings和jasper报告进行最后一年的项目报告。当我在netbeans中运行应用程序但是当我将它部署到jar文件然后尝试执行它时,包括报告的应用程序工作正常使用我的命令提示符,我看到了这个巨大的异常文本。

I'm working on my final year project using java swings and jasper reports for reporting.The application including the reports work fine when I run the application in netbeans but when I deploy it to a jar file and then try to execute it using my command prompt I see this huge text of exception.


Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/codehaus/groovy/control/CompilationFailedException
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
        at java.lang.Class.getConstructor0(Unknown Source)
        at java.lang.Class.newInstance0(Unknown Source)
        at java.lang.Class.newInstance(Unknown Source)
        at net.sf.jasperreports.engine.JasperCompileManager.getCompiler(JasperCompileManager.java:472)
        at net.sf.jasperreports.engine.JasperCompileManager.loadEvaluator(JasperCompileManager.java:238)
        at net.sf.jasperreports.engine.fill.JRFillDataset.createCalculator(JRFillDataset.java:421)
        at net.sf.jasperreports.engine.fill.JRBaseFiller.(JRBaseFiller.java:428)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.(JRVerticalFiller.java:76)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.(JRVerticalFiller.java:86)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.(JRVerticalFiller.java:56)
        at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:142)
.
.
.
.
....54 more

以下函数调用jasper报告:

The following function invokes the jasper report :


    public void printReport(String adID){
       try {
            Map parameters = new HashMap();
            InputStream jasperIS =this.getClass().getResourceAsStream("/Reports/AllHoardings.jasper");
            User connect=new User();
            JasperPrint print=JasperFillManager.fillReport(jasperIS,parameters,connect.getConnection());
            JasperViewer.viewReport(print,false);
        }catch(JRException je){
            System.out.println(je.toString() +" @ line 2043");
        }catch (Exception e) { System.out.println(e.toString());       }
    }

http://i296.photobucket.com/albums/mm176/charanraj1191g/jasper.png

链接到图片:

< a href =http://i296.photobucket.com/albums/mm176/charanraj1191g/jasper.png =nofollow noreferrer>

Snap Shot

http://i296.photobucket.com/albums/mm176/charanraj1191g/dir_list.png

链接到图像:

项目目录列表在netbeans中

http://i296.photobucket.com/albums/mm176/charanraj1191g/jar.png

链接到图像:

在jar文件中

推荐答案

java.lang.NoClassDefFoundError: org/codehaus/groovy/control/CompilationFailedException

这个错误告诉我,NetBeans正在以一种你的JAR文件没有的方式解决Groovy和Jasper Reports的问题。检查JAR清单中是否缺少与Groovy相关的JAR。如果是,请添加它们。

This error suggests to me that NetBeans is solving your issues with Groovy and Jasper Reports in a way that your JAR file is not. Check to see if there are JARs missing from your JAR manifest that pertain to Groovy. If yes, add them.

这篇关于Jasper报告在netbeans中运行良好,但在部署为jar应用程序时会出现异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆