Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 opened this issue Jan 10, 2025 · 3 comments

Comments

@Nikiba00
Copy link

Nikiba00 commented Jan 10, 2025

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
     }
@itssDavyd
Copy link

Hi, can you solved this bug??

@yathavsritechnology
Copy link

I am also getting this error for newer version of jdk (JDK 17 in my system). i am using debian 12 OS

@1stepatatim3
Copy link

1stepatatim3 commented Mar 5, 2025

i had the same error. solved it by changing jdk-17 to jdk-8 following https://stackoverflow.com/questions/57555867/error-with-versions-of-jdk-while-creating-report-using-phpjasper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants