Following the guide here it works perfectly.

But if have have a java agent, newrelic for example you get an error (at the bottom).

Appreciate that it looks more of a Java limitation than a spring related issue.

Reason I've raised it here is that probably in this place is common to have a java agent (new relic, datadog etc...)

Is there a way to have it working?

So far I tried: - Removing the java agent and it just works (of course) - passing -XX:+UnlockDiagnosticVMOptions -XX:+AllowArchivingWithJavaAgent -XX:AOTMode=record... which still doesn't work with same error. But even if it did I wonder if it's the correct thing to do

[0.014s][info][aot] ArchiveRelocationMode == 1: always map archive(s) at an alternative address

[0.014s][info][aot] Try to map archive(s) at an alternative address

[0.014s][info][aot] Reserved archive_space_rs [0x00001f8000000000 - 0x00001f8005000000] (83886080) bytes (includes protection zone)

[0.014s][info][aot] Reserved class_space_rs   [0x00001f8005000000 - 0x00001f8045000000] (1073741824) bytes

[0.014s][info][aot] Mapped static  region #0 at base 0x00001f8000010000 top 0x00001f8001e90000 (ReadWrite)

[0.014s][info][aot] Mapped static  region #1 at base 0x00001f8001e90000 top 0x00001f8004b10000 (ReadOnly)

[0.014s][info][aot] Mapped static  region #2 at base 0x0000ffff824e0000 top 0x0000ffff82600000 (Bitmap)

[0.063s][info][aot] archived module property jdk.module.main: (null)

[0.063s][info][aot] archived module property jdk.module.addexports: (null)

[0.063s][info][aot] archived module property jdk.module.addmods: (null)

[0.063s][error][aot] An error has occurred while processing the AOT cache. Run with -Xlog:aot for details.

[0.063s][error][aot] Mismatched values for property jdk.module.addmods: java.instrument specified during runtime but not during dump time

[0.063s][error][aot] Disabling optimized module handling

[0.063s][info ][aot] archived module property jdk.module.enable.native.access: (null)

[0.063s][info ][aot] archived module property jdk.module.addopens: (null)

[0.063s][info ][aot] archived module property jdk.module.addreads: (null)

[0.063s][info ][aot] optimized module handling: disabled

[0.063s][info ][aot] full module graph: disabled

[0.063s][error][aot] AOT cache has aot-linked classes. It cannot be used when archived full module graph is not used.

[0.063s][info ][aot] Unmapping region #0 at base 0x00001f8000010000 (ReadWrite)

[0.063s][info ][aot] Region #0 (ReadWrite) is in a reserved space, it will be freed when the space is released

[0.063s][info ][aot] Unmapping region #1 at base 0x00001f8001e90000 (ReadOnly)

[0.063s][info ][aot] Region #1 (ReadOnly) is in a reserved space, it will be freed when the space is released

[0.063s][info ][aot] Unmapping region #2 at base 0x0000ffff824e0000 (Bitmap)

[0.066s][error][aot] Unable to map shared spaces

Comment From: philwebb

I'm not personally aware of anyone using agents with AOT/CDS. Perhaps a question on stackoverflow.com might gain traction. I'm going to close this one here as we prefer to keep the issue tracker for bugs and enhancements and it doesn't look like there's anything we can do to help make things work.