https://mail.openjdk.org/pipermail/leyden-dev/2025-March/001699.html
https://mail.openjdk.org/pipermail/leyden-dev/2025-March/001703.html
When an AOT cache is created with this:
java -XX:AOTMode=create -XX:AOTConfiguration=app.aotconf \
-XX:AOTCache=app.aot \
-Dcom.sun.management=...
The VM will try to start a JMX agent, and can run into an exception like this:
java.lang.IllegalArgumentException: javax.management.NotCompliantMBeanException: com.sun.management.UnixOperatingSystemMXBean: During -Xshare:dump, module system cannot be modified after it's initialized
at java.management/javax.management.StandardMBean.<init>(StandardMBean.java:270)
[........]
Caused by: java.lang.UnsupportedOperationException: During -Xshare:dump, module system cannot be modified after it's initialized
at java.base/java.lang.Module.defineModule0(Native Method)
at java.base/java.lang.Module.<init>(Module.java:141)
at java.base/java.lang.System$1.defineModule(System.java:2036)
at java.base/jdk.internal.module.Modules.defineModule(Modules.java:80)
at java.base/java.lang.reflect.Proxy$ProxyBuilder.lambda$getDynamicModule$0(Proxy.java:832)
at java.base/jdk.internal.loader.AbstractClassLoaderValue$Memoizer.get(AbstractClassLoaderValue.java:329)
at java.base/jdk.internal.loader.AbstractClassLoaderValue.computeIfAbsent(AbstractClassLoaderValue.java:205)
at java.base/java.lang.reflect.Proxy$ProxyBuilder.getDynamicModule(Proxy.java:823)
===============
Proposal:
CDS only archives the boot layer. The above operation doesn't modify the contents of the boot layer, so should be allowed.
We should relax the HotSpot function Modules::check_cds_restrictions() to allow operations that doesn't modify the contents of the boot layer.
===============
Work-around
When creating the AOT cache, do not pass any VM arguments that may start a JMX agent, or otherwise cause new modules to be loaded.
https://mail.openjdk.org/pipermail/leyden-dev/2025-March/001703.html
When an AOT cache is created with this:
java -XX:AOTMode=create -XX:AOTConfiguration=app.aotconf \
-XX:AOTCache=app.aot \
-Dcom.sun.management=...
The VM will try to start a JMX agent, and can run into an exception like this:
java.lang.IllegalArgumentException: javax.management.NotCompliantMBeanException: com.sun.management.UnixOperatingSystemMXBean: During -Xshare:dump, module system cannot be modified after it's initialized
at java.management/javax.management.StandardMBean.<init>(StandardMBean.java:270)
[........]
Caused by: java.lang.UnsupportedOperationException: During -Xshare:dump, module system cannot be modified after it's initialized
at java.base/java.lang.Module.defineModule0(Native Method)
at java.base/java.lang.Module.<init>(Module.java:141)
at java.base/java.lang.System$1.defineModule(System.java:2036)
at java.base/jdk.internal.module.Modules.defineModule(Modules.java:80)
at java.base/java.lang.reflect.Proxy$ProxyBuilder.lambda$getDynamicModule$0(Proxy.java:832)
at java.base/jdk.internal.loader.AbstractClassLoaderValue$Memoizer.get(AbstractClassLoaderValue.java:329)
at java.base/jdk.internal.loader.AbstractClassLoaderValue.computeIfAbsent(AbstractClassLoaderValue.java:205)
at java.base/java.lang.reflect.Proxy$ProxyBuilder.getDynamicModule(Proxy.java:823)
===============
Proposal:
CDS only archives the boot layer. The above operation doesn't modify the contents of the boot layer, so should be allowed.
We should relax the HotSpot function Modules::check_cds_restrictions() to allow operations that doesn't modify the contents of the boot layer.
===============
Work-around
When creating the AOT cache, do not pass any VM arguments that may start a JMX agent, or otherwise cause new modules to be loaded.