Error using DynamicReports with Lucee: java.lang.Object cannot be resolved

Hello.
I’m trying to create a simple PDF report with Lucee v5.3.9+ 141 and DynamicReports v 6.12.1 (https://dynamicreports.lbayer.com). I managed to load a simple OSGI Jar bundle and the first time I run it in Lucee, the report is generated correctly, but the second time I get this error:

net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: 
1. The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files /* ^ 
2. The type java.lang.String cannot be resolved. It is indirectly referenced from required .class files /* ^ 
3. JREvaluator cannot be resolved to a type public class Report_1664969584830_647639 extends JREvaluator 
4. JRFillParameter cannot be resolved to a type private JRFillParameter parameter_IS_IGNORE_PAGINATION = null; 
5. JRFillParameter cannot be resolved to a type private JRFillParameter parameter_REPORT_CONNECTION = null;  
6. JRFillParameter cannot be resolved to a type private JRFillParameter parameter_FILTER = null; 
7. JRFillParameter cannot be resolved to a type private JRFillParameter parameter_DYNAMICREPORTS_SCRIPTLET = null;

For this I create a maven project with this class (SimpleReport.java):

package org.test.simplereport;

import static net.sf.dynamicreports.report.builder.DynamicReports.report;
import static net.sf.dynamicreports.report.builder.DynamicReports.col;
import static net.sf.dynamicreports.report.builder.DynamicReports.type;
import static net.sf.dynamicreports.report.builder.DynamicReports.export;
import net.sf.dynamicreports.report.datasource.DRDataSource;
import net.sf.dynamicreports.report.exception.DRException;

public class SimpleReport{
    public static void main(String[] args) throws DRException{
        String destino = "report_simple.pdf";
        new SimpleReport().build(destino);
    }

    public void build(String destino) throws DRException{
        String[] columnas = {"item", "price"};
        String[] fila = {"thing","10000000"};
        DRDataSource datasource = new DRDataSource(columnas);

        datasource.add((Object[])fila);

        report()
            .columns(
                col.column("Item", "item", type.stringType()),
                col.column("Precio", "precio", type.stringType())
            )
            .setDataSource(datasource)
            .toPdf(export.pdfExporter(destino));
    }
}

After compiling I create an OSGI Bundle jar with this MANIFEST:

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven 3.8.6
Built-By: franjial
Build-Jdk: 11.0.16
Bundle-Classpath: ant-1.7.1.jar,ant-launcher-1.7.1.jar,avalon-framework-
 impl-4.2.0.jar,barcode4j-2.1.jar,batik-anim-1.12.jar,batik-awt-util-1.12
 .jar,batik-bridge-1.12.jar,batik-constants-1.12.jar,batik-css-1.12.jar,b
 atik-dom-1.12.jar,batik-ext-1.12.jar,batik-gvt-1.12.jar,batik-i18n-1.12.
 jar,batik-parser-1.12.jar,batik-script-1.12.jar,batik-svg-dom-1.12.jar,b
 atik-util-1.12.jar,batik-xml-1.12.jar,bcprov-jdk15on-1.62.jar,commons-be
 anutils-1.9.4.jar,commons-cli-1.0.jar,commons-collections-3.2.2.jar,comm
 ons-collections4-4.2.jar,commons-digester-2.1.jar,commons-io-1.3.1.jar,c
 ommons-lang-1.0.jar,commons-lang3-3.11.jar,commons-logging-1.1.1.jar,com
 mons-text-1.9.jar,core-3.3.3.jar,dynamicreports-core-6.12.1.jar,ecj-4.4.
 2.jar,itext-2.1.7.js7.jar,jackson-annotations-2.10.0.jar,jackson-core-2.
 10.0.jar,jackson-databind-2.10.0.jar,jakarta.activation-api-1.2.2.jar,ja
 karta.xml.bind-api-2.3.3.jar,jasperreports-6.12.2.jar,jcommon-1.0.23.jar
 ,jfreechart-1.0.19.jar,junit-3.7.jar,xml-apis-1.4.01.jar,xml-apis-ext-1.
 3.04.jar,xmlgraphics-commons-2.4.jar,.
Bundle-Description: simplereport bundle
Bundle-ManifestVersion: 2
Bundle-Name: SimpleReport
Bundle-SymbolicName: org.test.simplereport
Bundle-Vendor: ISOTools simplereport project
Bundle-Version: 1.0.1
Export-Package: org.test.simplereport
Main-Class: org.test.simplereport.SimpleReport

And finally I use Commandbox to create a Lucee server where I execute the following cfm:

<cftry>
    <cfscript>
        CFMLEngine = createObject( "java", "lucee.loader.engine.CFMLEngineFactory" ).getInstance();
        OSGiUtil = createObject( "java", "lucee.runtime.osgi.OSGiUtil" );

        reportsResource = CFMLEngine.getResourceUtil().toResourceExisting( getPageContext(), expandpath( 'simplereport-1.0.1.jar' ) );
        OSGiUtil.installBundle(
            CFMLEngine.getBundleContext(),
            reportsResource,
            true);

        reports = createObject("java", "org.test.simplereport.SimpleReport", "org.test.simplereport", "1.0.1");
        writeDump(reports);
    </cfscript>

    <cfcatch>
        <cfdump var="#cfcatch#">
    </cfcatch>
</cftry>

Thanks in advance

OS: Windows 10
Java Version: tested with 11.0.15 and 1.8.0_202
Deploy with CommandBox:
Lucee Version: 5.3.9+ 141

Hi @franjial, I am not sure why you getting this error.

Maybe the below points help to you

  1. You can create a pdf using the lucee built-in cfdocument tag.
    <cfdocument> :: Lucee Documentation

  2. Also, you can load the jar files with lucee using javaSettings in the Application or place your jar under the /lib folder.

this.javasettings.loadPaths = "path-to-the-jar-file-directory";

Hi! Thanks for your reply. The weird thing is that the first time the cfm is run, it works. Then it gives the error, and you have to restart Lucee to make it work again.
I need to use this library because I’m trying to reuse an existing project wrote in Java with DynamicReports. When I load the jars files with javaSettings I get the same result and I choose load with an OSGI bundle to avoid conflicts with dependencies.