<div dir="ltr"><div>Hi Sebastien,</div><div><br></div><div>Thanks for the information, great to see Spring keeping up to date with the latest JDK developments.</div><div><br></div><div>If tests are not the way to exercise the training run, then we will need to move the complexity to the CI/CD, where we deploy the app somewhere and exercise it, also thinking about what's next: JEP 515: Ahead-of-Time Method Profiling</div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">El sáb, 10 may 2025 a las 5:39, Sebastien Deleuze (<<a href="mailto:sebastien.deleuze@broadcom.com">sebastien.deleuze@broadcom.com</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Daniel,<div><br></div><div>The Spring team does not recommend generating the AOT cache using the app tests.</div><div><br></div><div>See related documentation and guidance in <a href="https://docs.spring.io/spring-framework/reference/7.0-SNAPSHOT/integration/aot-cache.html" target="_blank">https://docs.spring.io/spring-framework/reference/7.0-SNAPSHOT/integration/aot-cache.html</a> and <a href="https://docs.spring.io/spring-boot/reference/packaging/class-data-sharing.html#packaging.class-data-sharing.aot-cache" target="_blank">https://docs.spring.io/spring-boot/reference/packaging/class-data-sharing.html#packaging.class-data-sharing.aot-cache</a>.</div><div><br></div><div>Best regards,</div><div>Sébastien</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 9, 2025 at 4:14 PM Daniel Andres Pelaez Lopez <<a href="mailto:estigma88@gmail.com" target="_blank">estigma88@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi loi,<div><br></div><div>Thanks for the input.</div><div><br></div><div>Yes, I am aware that packaging the app as a JAR will work, I have tested that before for production code, however, that doesn't fit the use case I am looking for: Using the app tests to generate the AOT cache. If we require to package a JAR that executes the tests, that seems like overkill. My thinking is that the Java community is most likely using CI/CD to run tests and using Maven/Gradle for that purpose, so, having support for creating the AOT cache from tests and from those tools, will allow to the community to adopt this features faster.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El jue, 8 may 2025 a las 21:58, <<a href="mailto:ioi.lam@oracle.com" target="_blank">ioi.lam@oracle.com</a>> escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>

  
  <div>
    <p>It looks like your classpath have some directories:</p>
    <p><br>
      [4,648s][error  ][cds        ] Error: non-empty directory
'/home/danielpelaez/Documents/Distribution/aot/java-aot/build/classes/java/test'<br>
      [4,648s][error  ][cds        ] Error: non-empty directory
'/home/danielpelaez/Documents/Distribution/aot/java-aot/build/classes/java/main'<br>
      [4,648s][error  ][cds        ] Error: non-empty directory
'/home/danielpelaez/Documents/Distribution/aot/java-aot/build/resources/main'</p>
    <p><br>
    </p>
    <p>Please try to package these directories into a JAR file and use
      that in your classpath.</p>
    <p><br>
    </p>
    <p>Thanks</p>
    <p>- Ioi<br>
    </p>
    <div>On 5/7/25 12:57 PM, Daniel Andres
      Pelaez Lopez wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div>Hi everyone,</div>
        <div><br>
        </div>
        <div>We are testing JEP 483 on JDK 24 using the following dummy
          Gradle Spring Boot project: <a href="https://github.com/estigma88/java-aot/tree/master" target="_blank">https://github.com/estigma88/java-aot/tree/master</a>.
          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:</div>
        <div><br>
        </div>
        <div>tasks.withType<Test> {<br>
             useJUnitPlatform()<br>
          <br>
             project.findProperty("aot")?.let {<br>
                val aotFlags = it.toString().split(",")<br>
                jvmArgs(aotFlags)<br>
              }<br>
          }</div>
        <div><br>
        </div>
        <div>And we are using the following commands to generate the AOT
          cache:</div>
        <div><br>
        </div>
        <div>./gradlew :test
          -Paot="-XX:AOTMode=record,-XX:AOTConfiguration=app.aotconf"
          -> This one succeed</div>
        <div><br>
        </div>
        <div>./gradlew :test
-Paot="-XX:AOTMode=create,-XX:AOTConfiguration=app.aotconf,-XX:AOTCache=app.aot"
          -> This one fails</div>
        <div><br>
        </div>
        <div>The following are the logs for the create command:</div>
        <div><br>
        </div>
        <div>[1,328s][warning][cds] Preload Warning: Verification failed
          for org.springframework.http.client.ReactorResourceFactory<br>
          [1,579s][warning][cds] Preload Warning: Verification failed
          for
org.springframework.test.context.transaction.TransactionalTestExecutionListener<br>
          [1,581s][warning][cds] Preload Warning: Verification failed
          for
          org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener<br>
          [1,668s][warning][cds] Preload Warning: Verification failed
          for
          org.springframework.boot.logging.log4j2.Log4J2LoggingSystem<br>
          [2,412s][warning][cds] Preload Warning: Verification failed
          for
          org.springframework.http.codec.multipart.DefaultPartHttpMessageReader<br>
          [2,575s][warning][cds] Preload Warning: Verification failed
          for
org.springframework.boot.autoconfigure.cache.InfinispanCacheConfiguration<br>
          [2,577s][warning][cds] Preload Warning: Verification failed
          for
          org.springframework.boot.autoconfigure.cache.RedisCacheConfiguration<br>
          [2,799s][warning][cds] Preload Warning: Verification failed
          for
          org.springframework.boot.jdbc.init.DataSourceScriptDatabaseInitializer<br>
          [3,029s][warning][cds] Preload Warning: Verification failed
          for
          org.springframework.core.ReactiveAdapterRegistry$ReactorAdapter<br>
          [3,109s][warning][cds] Preload Warning: Verification failed
          for
org.springframework.boot.http.client.JettyClientHttpRequestFactoryBuilder<br>
          [3,110s][warning][cds] Preload Warning: Verification failed
          for
org.springframework.boot.http.client.HttpComponentsClientHttpRequestFactoryBuilder<br>
          [3,180s][warning][cds] java.lang.ClassNotFoundException:
          org.mockito.internal.creation.bytebuddy.inject.MockMethodDispatcher<br>
          [3,180s][warning][cds] Preload Warning: Cannot find
          org/mockito/internal/creation/bytebuddy/inject/MockMethodDispatcher<br>
          [3,196s][warning][cds] Preload Warning: Verification failed
          for
          org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator<br>
          [3,197s][warning][cds] java.lang.NoClassDefFoundError:
          org/mockito/internal/creation/bytebuddy/inject/MockMethodDispatcher<br>
          [3,197s][warning][cds] Preload Warning: Cannot find
          org/mockito/internal/creation/bytebuddy/MockMethodAdvice<br>
          [3,307s][warning][cds] java.lang.ClassNotFoundException:
          net.bytebuddy.utility.Invoker$Dispatcher<br>
          [3,307s][warning][cds] Preload Warning: Cannot find
          net/bytebuddy/utility/Invoker$Dispatcher<br>
          [3,906s][warning][cds,resolve] :<br>
          An error has occurred while processing class list file
          app.aotconf 9635:5.<br>
          [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<br>
          class org/mockito/internal/creation/bytebuddy/MockMethodAdvice
          is not (yet) loaded by one of the built-in
          loaders[3,906s][warning][cds,resolve]     ^<br>
          [3,906s][warning][cds,resolve] Your classlist may be out of
          sync with the JDK or the application.<br>
          An error has occurred while processing class list file
          app.aotconf 11862:5.<br>
          [4,467s][warning][cds,resolve] :<br>
          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<br>
          [4,467s][warning][cds,resolve]     ^<br>
          [4,467s][warning][cds,resolve] Your classlist may be out of
          sync with the JDK or the application.<br>
          [4,608s][warning][cds        ] Preload Warning: Verification
          failed for
          org.springframework.web.servlet.view.freemarker.FreeMarkerView<br>
          [4,648s][error  ][cds        ] Error: non-empty directory
'/home/danielpelaez/Documents/Distribution/aot/java-aot/build/classes/java/test'<br>
          [4,648s][error  ][cds        ] Error: non-empty directory
'/home/danielpelaez/Documents/Distribution/aot/java-aot/build/classes/java/main'<br>
          [4,648s][error  ][cds        ] Error: non-empty directory
'/home/danielpelaez/Documents/Distribution/aot/java-aot/build/resources/main'<br>
          Hint: enable -Xlog:class+path=info to diagnose the failure<br>
          Error occurred during CDS dumping<br>
          Cannot have non-empty directory in paths</div>
        <div><br>
        </div>
        <div>Error logs seem related to the AOT feature and not Gradle,
          but you will know better.</div>
        <div><br>
        </div>
        <div>Any help would be appreciated.</div>
        <div><br>
        </div>
        <span class="gmail_signature_prefix">-- </span><br>
        <div dir="ltr" class="gmail_signature">
          <div dir="ltr">
            <div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse;color:rgb(136,136,136)">Daniel</span><br>
              <div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse;color:rgb(136,136,136)">e.
                  <a href="mailto:estigma88@gmail.com" target="_blank">estigma88@gmail.com</a></span></div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
  </div>

</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse;color:rgb(136,136,136)">Daniel</span><div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse;color:rgb(136,136,136)">e. <a href="mailto:estigma88@gmail.com" target="_blank">estigma88@gmail.com<br></a></span></div></div></div></div></div>
</blockquote></div>

<br>
<span style="background-color:rgb(255,255,255)"><font size="2">This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it.</font></span></blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse;color:rgb(136,136,136)">Daniel</span><div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse;color:rgb(136,136,136)">e. <a href="mailto:estigma88@gmail.com" target="_blank">estigma88@gmail.com</a></span></div></div></div></div></div></div>