pentaho-reporting icon indicating copy to clipboard operation
pentaho-reporting copied to clipboard

There are no chart images

Open khauser opened this issue 9 months ago • 1 comments

Hi there,

we try to use the pentaho reporting SDK within a spring boot application.

build.gradle:

plugins {
    id 'java'
    id 'org.springframework.boot' version '3.2.5'
    id 'io.spring.dependency-management' version '1.1.4'
}
...
java {
    sourceCompatibility = '21'
}

repositories {
    mavenCentral()
    maven { url 'https://repo.orl.eng.hitachivantara.com/artifactory/pnt-mvn/'  }
}

ext {
    pentahoReportingVersion = '9.4.0.0-343'
    postgresqlVersion = '42.7.1'
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-freemarker'
    implementation 'org.springframework.boot:spring-boot-starter-jdbc'

    runtimeOnly group: 'org.postgresql', name: 'postgresql', version: "${postgresqlVersion}"

    implementation group: 'org.pentaho.reporting.engine', name: 'classic-core', version: "${pentahoReportingVersion}"
    implementation group: 'org.pentaho.reporting.engine', name: 'classic-extensions', version: "${pentahoReportingVersion}"
    implementation group: 'org.pentaho.reporting.engine', name: 'legacy-charts', version: "${pentahoReportingVersion}"

    implementation group: 'org.jfree', name: 'jfreechart', version: '1.0.19'
...

ReportingService.java:

        ClassicEngineBoot.getInstance().start();

        final ResourceManager resourceManager = new ResourceManager();
        resourceManager.registerDefaults();

        final var baos = new ByteArrayOutputStream();

        try
        {
            Resource res = resourceManager.createDirectly(
                            resourceLoader.getResource(REPORTING_FILE_PATH).getURI().toURL(), MasterReport.class);
            final MasterReport masterReport = (MasterReport)res.getResource();
            queryParams = Map.ofEntries(....);

            addParametersToReport(masterReport, queryParams);

            HtmlReportUtil.createStreamHTML(masterReport, baos);

With this our report is generated but there are no chart images shown. What could be the problem here? In the report designer the charts show up.

Thanks for help! Karsten

khauser avatar May 16 '24 14:05 khauser