Skip to content

Upgrade classgraph #1424

Closed
Closed

Description

@FrelliBB

Describe the bug

Additional context
I haven't been able to get clear reproduction steps in a standalone project, but within one of our company's microservices, when updating to springdoc-openapi-ui to 1.6.3 we started seeing weird reflection errors on startup of our Spring Boot service that can be traced back to this release.

Activity

  1. youming-lin commented on Jan 4, 2022

    @youming-lin

    Same, I have issue with starting the Spring Boot app after updating to 1.6.3 with this error:

    Caused by: io.github.toolfactory.jvm.Driver$InitializationException: Could not initiliaze DefaultDriver
    	at io.github.toolfactory.jvm.DefaultDriver.throwException(DefaultDriver.java:324) ~[jvm-driver-4.0.0.jar:na]
    	at io.github.toolfactory.jvm.DefaultDriver.<init>(DefaultDriver.java:121) ~[jvm-driver-4.0.0.jar:na]
    	at nonapi.io.github.classgraph.utils.ReflectionUtils.<clinit>(ReflectionUtils.java:48) ~[classgraph-4.8.117.jar:4.8.117]
    	... 36 common frames omitted
    Caused by: io.github.toolfactory.jvm.ObjectProvider$BuildingException: Unable to build the related object of io.github.toolfactory.jvm.function.catalog.GetDeclaredFieldsMethodHandleSupplier
    	at io.github.toolfactory.jvm.ObjectProvider.getOrBuildObject(ObjectProvider.java:57) ~[jvm-driver-4.0.0.jar:na]
    	at io.github.toolfactory.jvm.DefaultDriver.initDeclaredFieldsRetriever(DefaultDriver.java:294) ~[jvm-driver-4.0.0.jar:na]
    	at io.github.toolfactory.jvm.DefaultDriver.<init>(DefaultDriver.java:105) ~[jvm-driver-4.0.0.jar:na]
    	... 37 common frames omitted
    Caused by: java.lang.reflect.InvocationTargetException: null
    	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
    	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:na]
    	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]
    	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[na:na]
    	at io.github.toolfactory.jvm.ObjectProvider.getOrBuildObject(ObjectProvider.java:51) ~[jvm-driver-4.0.0.jar:na]
    	... 39 common frames omitted
    Caused by: java.lang.NoSuchMethodException: null
    	at java.base/java.lang.invoke.PrimitiveHandle.finishMethodInitialization(PrimitiveHandle.java:198) ~[na:na]
    	at java.base/java.lang.invoke.DirectHandle.<init>(DirectHandle.java:51) ~[na:na]
    	at java.base/java.lang.invoke.DirectHandle.<init>(DirectHandle.java:43) ~[na:na]
    	at java.base/java.lang.invoke.MethodHandles$Lookup.findSpecialImpl(MethodHandles.java:619) ~[na:na]
    	at java.base/java.lang.invoke.MethodHandles$Lookup.findSpecial(MethodHandles.java:587) ~[na:na]
    	at io.github.toolfactory.jvm.function.catalog.GetDeclaredFieldsMethodHandleSupplier$ForJava7.<init>(GetDeclaredFieldsMethodHandleSupplier.java:55) ~[jvm-driver-4.0.0.jar:na]
    	... 44 common frames omitted
    Caused by: java.lang.NoSuchMethodError: java/lang/Class.getDeclaredFields0(Z)[Ljava/lang/reflect/Field; (loaded from jrt:/java.base by <Bootstrap Loader>) called from class java.lang.Class (loaded from jrt:/java.base by <Bootstrap Loader>).
    	at java.base/java.lang.invoke.PrimitiveHandle.lookupMethod(Native Method) ~[na:na]
    	at java.base/java.lang.invoke.PrimitiveHandle.finishMethodInitialization(PrimitiveHandle.java:196) ~[na:na]
    	... 49 common frames omitted
    

    Based on my Googling there was a similar issue reported in classgraph: classgraph/classgraph#568

    I manually overrode classgraph version to their latest, 4.8.138, and the app starts fine.

    TL;DR
    Can Springdoc update to a good classgraph version ASAP?

    Edit:
    I see there is a PR already: #1423

  2. changed the title [-]Regression with classgraph-4.8.117[/-] [+]Upgrade classgraph[/+] on Jan 4, 2022
  3. added 3 commits that reference this issue on Jan 4, 2022
    2b0582e
    fac2f4e
    b2c3ffd
  4. FrelliBB commented on Jan 6, 2022

    @FrelliBB
    Author

    Thanks for resolving this @bnasslahsen, do you have an indication of when the new version will be released?

  5. bnasslahsen commented on Jan 6, 2022

    @bnasslahsen
    Collaborator

    @FrelliBB,

    Today

  6. FrelliBB commented on Jan 6, 2022

    @FrelliBB
    Author

    Perfect, thank you!

  7. locked as resolved and limited conversation to collaborators on Feb 5, 2023
  8. added 3 commits that reference this issue on May 17, 2025
    766ab25
    bc00b06
    81b7df9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions