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

Suggest to Update io.github.classgraph version to 4.8.178 to solve Quarkus related ExceptionInInitializerError #2627

Open
abdallah-rashwan opened this issue Nov 20, 2024 · 4 comments
Assignees

Comments

@abdallah-rashwan
Copy link

Hello everyone

I'm using [email protected] for running integration tests for a Quarkus application. After upgrading to Quarkus version 3.16.3 I keeps receiving an exception "stacktrace added below", its mainly related to a NPE handler from QuarkusClassLoaderHandler from io.github.classgraph. Doing some investigation I've seen that you're using maven-shade-plugin to relocate some package to different names with Karate prefix, so this QuarkusClassLoaderHandler class is being added to Karate package.

Below is the exception trace I'm receiving.

Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Collection.iterator()" because the return value of "karate.nonapi.io.github.classgraph.reflection.ReflectionUtils.getFieldVal(boolean, Object, String)" is null at karate.nonapi.io.github.classgraph.classloaderhandler.QuarkusClassLoaderHandler.findClasspathOrderForQuarkusClassloader(QuarkusClassLoaderHandler.java:120) at karate.nonapi.io.github.classgraph.classloaderhandler.QuarkusClassLoaderHandler.findClasspathOrder(QuarkusClassLoaderHandler.java:111) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ... 18 more

Runner.path("path").parallel(1); is to reproduce the issue.

After doing some investigation I found out that this error is coming from io.github.classgraph and being solved here classgraph/classgraph#893 which is fixing classgraph/classgraph#891 .

My suggestion is basically upgrade io.github.classgraph dependency version for 4.1.178 at least and I believe it will fix it.

My environment is as follows.
JDK: 21
Quarkus: 3.16.3
Karate: 1.5.0

@ptrthomas ptrthomas self-assigned this Nov 20, 2024
@ptrthomas
Copy link
Member

@abdallah-rashwan noted and thanks for the report. can you also confirm if using the "all" classifier (shaded JAR) solves the problem as described here: https://github.com/karatelabs/karate-examples/blob/main/database/README.md#using-the-shaded-jar

@abdallah-rashwan
Copy link
Author

abdallah-rashwan commented Nov 21, 2024

Hi @ptrthomas thanks for your quick response. Unfortunately classifier "all" not solving the problem. I believe its because of the relocation of the packages.
Even when trying to exclude the target library io.github.classgraph from karate to explicitly add the desired version, Karate doesn't see the new version for some reason.

@ptrthomas
Copy link
Member

@abdallah-rashwan that is a bit surprising. we can certainly bump the version, but if you can submit a way to replicate the problem using this project as a base, that would be great: https://github.com/karatelabs/karate-examples/blob/main/quarkus/README.md

@abdallah-rashwan
Copy link
Author

abdallah-rashwan commented Nov 21, 2024

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

No branches or pull requests

2 participants