JDK-8151099 : java.lang.management.ManagementFactory.getPlatformMXBeans() should work even if jdk.management is not present
  • Type: Bug
  • Component: core-svc
  • Sub-Component: java.lang.management
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-03-02
  • Updated: 2016-11-23
  • Resolved: 2016-10-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b146Fixed
Related Reports
Duplicate :  
Duplicate :  
Description
Tests in java/lang/management/ManagementFactory fail with 
java.lang.NoClassDefFoundError: com/sun/management/internal/GarbageCollectorExtImpl
when run with "-javaoptions:-limitmods java.management"

java.lang.NoClassDefFoundError: com/sun/management/internal/GarbageCollectorExtImpl
       at sun.management.MemoryImpl.getMemoryManagers0(java.management@9-internal/Native Method)
       at sun.management.MemoryImpl.getMemoryManagers(java.management@9-internal/MemoryImpl.java:98)
       at sun.management.ManagementFactoryHelper.getGarbageCollectorMXBeans(java.management@9-internal/ManagementFactoryHelper.java:137)
       at java.lang.management.DefaultPlatformMBeanProvider$4.nameToMBeanMap(java.management@9-internal/DefaultPlatformMBeanProvider.java:185)
       at sun.management.spi.PlatformMBeanProvider$PlatformComponent.getMBeans(java.management@9-internal/PlatformMBeanProvider.java:195)
       at java.lang.management.ManagementFactory.lambda$getPlatformMXBeans$3(java.management@9-internal/ManagementFactory.java:683)
       at java.util.stream.ReferencePipeline$7$1.accept(java.base@9-internal/ReferencePipeline.java:269)
       at java.util.HashMap$ValueSpliterator.forEachRemaining(java.base@9-internal/HashMap.java:1672)
       at java.util.stream.AbstractPipeline.copyInto(java.base@9-internal/AbstractPipeline.java:482)
       at java.util.stream.AbstractPipeline.wrapAndCopyInto(java.base@9-internal/AbstractPipeline.java:472)
       at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(java.base@9-internal/ReduceOps.java:913)
       at java.util.stream.AbstractPipeline.evaluate(java.base@9-internal/AbstractPipeline.java:234)
       at java.util.stream.ReferencePipeline.collect(java.base@9-internal/ReferencePipeline.java:511)
       at java.lang.management.ManagementFactory.getPlatformMXBeans(java.management@9-internal/ManagementFactory.java:684)
       at GetPlatformManagementInterfaces.main(GetPlatformManagementInterfaces.java:68)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(java.base@9-internal/Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(java.base@9-internal/NativeMethodAccessorImpl.java:62)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(java.base@9-internal/DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(java.base@9-internal/Method.java:531)
       at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:110)
       at java.lang.Thread.run(java.base@9-internal/Thread.java:804)
Comments
Attached test: java/lang/management/ManagementFactory/DefaultManagementProviderTest.java
12-05-2016

ILW = M (failure for some tests) M (specific options required --addmods java.management ) H = P3
04-03-2016

A smaller test case: List<? extends PlatformManagedObject> list = ManagementFactory.getPlatformMXBeans(GarbageCollectorMXBean.class); list.forEach(pm -> System.out.println(pm.getObjectName())); $ jlink --output myimage --addmods java.management --modulepath jmods $ myimage/bin/java Test Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/management/internal/GarbageCollectorExtImpl Probably VM assumes com.sun.management.internal.GarbageCollectorExtImpl exists.
03-03-2016