Skip to content

Exception in thread "main" java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap') #350

Open
@Nikiba00

Description

@Nikiba00

Hi,
Been working on this for a few days and I can't solve this. Whenever I wanna process a .jasper it doesn't work and I get that error instead. I'm working with php 8.1.25, xampp v3.3.0 and since I started 'til now I've been changing my jdk version. At first I thought it was a JasperReports library version (changed it too from 7.0.1 to 6.4.3 on Jaspersoft Studio), then I read something about the jdk but I've tried with jdk 17 (the first one), jdk 1.8.0_60, jdk 1.8.0_251 and now I'm currently with 1.7.0_80 and still the same. I've also tried to generate the pdf using the console but it doesn't work either. Now I'm trying with the hello_world example but the output is the same error/exception

use PHPJasper\PHPJasper;

public function crearReporteArticulo($eventoId, $articuloId)
    {
        require base_path('/vendor/autoload.php');
        $input = __DIR__ . '/vendor/geekcom/phpjasper/examples/hello_world.jasper';
        $output = __DIR__ . '/vendor/geekcom/phpjasper/examples';
        $options = [
            'format' => ['pdf', 'rtf']
        ];
        $jasper = new PHPJasper();
        $jasper->process(
            $input,
            $output,
            $options
        )->execute();//here it crashes
     }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions