agmoyano / node-jasper

JasperReports from Node.js
84 stars 52 forks source link

Error running static method #72

Open Toloto opened 2 years ago

Toloto commented 2 years ago

The following error is occurring. in the code below

PrintJasper: async (req, res) => {

    var reports = jasper({
        path: '../reports',
        reports: {
            hw: {
                jasper: '../reports/sample.jasper',            

            }
        }
    })
    reports.ready(async function () {
        var report = {
            report: 'hw',
            data: {
                language: 'spanish',
                // on jasper make a parameter named "dataset2" and use on a subreport:
                // ((net.sf.jasperreports.engine.data.JsonDataSource)$P{dataset2})
                dataset:
                    { value: 1, value: 2 }
            },
            dataset: [
                {
                    name: 'Gonzalo',
                    lastname: 'Vinas' // TODO: check on UTF-8
                },
                {
                    name: 'Agustin',
                    lastname: 'Moyano'
                }
            ]
        }

        console.log({ reports:await report })

        var pdf = reports.pdf(await report);

        res.set({
            'Content-type': 'application/pdf',
            'Content-Length': pdf.length
        });
        res.send(pdf);

    })
}

Error below

var p = self.jfm.fillReportSync(path.resolve(self.parentPath,item.jasper), data, conn);

Error: Error running static method java.lang.NoClassDefFoundError: org/codehaus/groovy/control/CompilationFailedException at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3137) at java.base/java.lang.Class.getConstructor0(Class.java:3342) at java.base/java.lang.Class.getConstructor(Class.java:2151) at net.sf.jasperreports.engine.JasperCompileManager.getCompiler(JasperCompileManager.java:823) at net.sf.jasperreports.engine.JasperCompileManager.getEvaluator(JasperCompileManager.java:381) at net.sf.jasperreports.engine.fill.JRFillDataset.createCalculator(JRFillDataset.java:494) at net.sf.jasperreports.engine.fill.BaseReportFiller.(BaseReportFiller.java:168) at net.sf.jasperreports.engine.fill.JRBaseFiller.(JRBaseFiller.java:272) at net.sf.jasperreports.engine.fill.JRVerticalFiller.(JRVerticalFiller.java:82) at net.sf.jasperreports.engine.fill.JRFiller.createBandReportFiller(JRFiller.java:251) at net.sf.jasperreports.engine.fill.JRFiller.createReportFiller(JRFiller.java:272) at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:156)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:651) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:1020) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) Caused by: java.lang.ClassNotFoundException: org.codehaus.groovy.control.CompilationFailedException at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 19 more

at C:\node_modules\node-jasper\index.js:338:21
at Array.forEach (<anonymous>)
at jasper.export (C:\node_modules\node-jasper\index.js:320:10)
at jasper.pdf (C:\node_modules\node-jasper\index.js:213:21)    at jasper.ready (C:\server\Modulos\teste.js:581:31) {

cause: nodeJava_java_lang_NoClassDefFoundError {}