JEP 483: Ahead-of-Time Class Loading & Linking failing on a simple Gradle Spring Boot project

Daniel Andres Pelaez Lopez estigma88 at gmail.com
Wed May 7 19:57:59 UTC 2025


Hi everyone,

We are testing JEP 483 on JDK 24 using the following dummy Gradle Spring
Boot project: https://github.com/estigma88/java-aot/tree/master. As we want
to generate the AOT cache from the tests, we added a custom Test task to
receive the AOT flags for the JVM as follows:

tasks.withType<Test> {
   useJUnitPlatform()

   project.findProperty("aot")?.let {
      val aotFlags = it.toString().split(",")
      jvmArgs(aotFlags)
    }
}

And we are using the following commands to generate the AOT cache:

./gradlew :test -Paot="-XX:AOTMode=record,-XX:AOTConfiguration=app.aotconf"
-> This one succeed

./gradlew :test
-Paot="-XX:AOTMode=create,-XX:AOTConfiguration=app.aotconf,-XX:AOTCache=app.aot"
-> This one fails

The following are the logs for the create command:

[1,328s][warning][cds] Preload Warning: Verification failed for
org.springframework.http.client.ReactorResourceFactory
[1,579s][warning][cds] Preload Warning: Verification failed for
org.springframework.test.context.transaction.TransactionalTestExecutionListener
[1,581s][warning][cds] Preload Warning: Verification failed for
org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener
[1,668s][warning][cds] Preload Warning: Verification failed for
org.springframework.boot.logging.log4j2.Log4J2LoggingSystem
[2,412s][warning][cds] Preload Warning: Verification failed for
org.springframework.http.codec.multipart.DefaultPartHttpMessageReader
[2,575s][warning][cds] Preload Warning: Verification failed for
org.springframework.boot.autoconfigure.cache.InfinispanCacheConfiguration
[2,577s][warning][cds] Preload Warning: Verification failed for
org.springframework.boot.autoconfigure.cache.RedisCacheConfiguration
[2,799s][warning][cds] Preload Warning: Verification failed for
org.springframework.boot.jdbc.init.DataSourceScriptDatabaseInitializer
[3,029s][warning][cds] Preload Warning: Verification failed for
org.springframework.core.ReactiveAdapterRegistry$ReactorAdapter
[3,109s][warning][cds] Preload Warning: Verification failed for
org.springframework.boot.http.client.JettyClientHttpRequestFactoryBuilder
[3,110s][warning][cds] Preload Warning: Verification failed for
org.springframework.boot.http.client.HttpComponentsClientHttpRequestFactoryBuilder
[3,180s][warning][cds] java.lang.ClassNotFoundException:
org.mockito.internal.creation.bytebuddy.inject.MockMethodDispatcher
[3,180s][warning][cds] Preload Warning: Cannot find
org/mockito/internal/creation/bytebuddy/inject/MockMethodDispatcher
[3,196s][warning][cds] Preload Warning: Verification failed for
org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator
[3,197s][warning][cds] java.lang.NoClassDefFoundError:
org/mockito/internal/creation/bytebuddy/inject/MockMethodDispatcher
[3,197s][warning][cds] Preload Warning: Cannot find
org/mockito/internal/creation/bytebuddy/MockMethodAdvice
[3,307s][warning][cds] java.lang.ClassNotFoundException:
net.bytebuddy.utility.Invoker$Dispatcher
[3,307s][warning][cds] Preload Warning: Cannot find
net/bytebuddy/utility/Invoker$Dispatcher
[3,906s][warning][cds,resolve] :
An error has occurred while processing class list file app.aotconf 9635:5.
[3,906s][warning][cds,resolve] @cp
org/mockito/internal/creation/bytebuddy/MockMethodAdvice 1 2 7 9 10 11 17
22 26 28 29 33 36 40 44 48 258
class org/mockito/internal/creation/bytebuddy/MockMethodAdvice is not (yet)
loaded by one of the built-in loaders[3,906s][warning][cds,resolve]     ^
[3,906s][warning][cds,resolve] Your classlist may be out of sync with the
JDK or the application.
An error has occurred while processing class list file app.aotconf 11862:5.
[4,467s][warning][cds,resolve] :
class org/mockito/internal/creation/bytebuddy/inject/MockMethodDispatcher
is not (yet) loaded by one of the built-in
loaders[4,467s][warning][cds,resolve] @cp
org/mockito/internal/creation/bytebuddy/inject/MockMethodDispatcher 1 2 8
14 20 25 27 38 59
[4,467s][warning][cds,resolve]     ^
[4,467s][warning][cds,resolve] Your classlist may be out of sync with the
JDK or the application.
[4,608s][warning][cds        ] Preload Warning: Verification failed for
org.springframework.web.servlet.view.freemarker.FreeMarkerView
[4,648s][error  ][cds        ] Error: non-empty directory
'/home/danielpelaez/Documents/Distribution/aot/java-aot/build/classes/java/test'
[4,648s][error  ][cds        ] Error: non-empty directory
'/home/danielpelaez/Documents/Distribution/aot/java-aot/build/classes/java/main'
[4,648s][error  ][cds        ] Error: non-empty directory
'/home/danielpelaez/Documents/Distribution/aot/java-aot/build/resources/main'
Hint: enable -Xlog:class+path=info to diagnose the failure
Error occurred during CDS dumping
Cannot have non-empty directory in paths

Error logs seem related to the AOT feature and not Gradle, but you will
know better.

Any help would be appreciated.

-- 
Daniel
e. estigma88 at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/leyden-dev/attachments/20250507/38a11bc5/attachment.htm>


More information about the leyden-dev mailing list