JDK-8188820 : AccessControlException: access denied in MemoryMXBeanTest.java
  • Type: Bug
  • Component: core-svc
  • Sub-Component: javax.management
  • Affected Version: 10
  • Priority: P2
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2017-10-05
  • Updated: 2020-09-01
  • Resolved: 2017-10-23
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 10
10Resolved
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
Tests:
com/sun/management/MemoryMXBeanTest.java
jdk/management/cmm/SystemResourcePressureMXBeanTest.java
sun/management/HSDiagHeapDump.java
javax/management/MBeanServer/PlatformMBeanTest.java
javax/management/security/CR16243976.java
javax/management/security/DeserializationSecurity/DeserializationSecurityTest.java 
com/oracle/jfr/jmx/security/TestEnoughPermission.java
com/oracle/jfr/jmx/security/TestNoControlPermission.java
com/oracle/jfr/jmx/security/TestNoMonitorPermission.java
com/oracle/jfr/jmx/security/TestNotificationListenerPermission.java


java.lang.ExceptionInInitializerError
	at java.management/java.lang.management.ManagementFactory.getPlatformMXBean(ManagementFactory.java:684)
	at java.management/java.lang.management.ManagementFactory.getMemoryMXBean(ManagementFactory.java:343)
	at MemoryMXBeanTest.main(MemoryMXBeanTest.java:41)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:115)
	at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.sun.management.spi")
	at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
	at java.base/java.security.AccessController.checkPermission(AccessController.java:895)
	at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:558)
	at java.base/java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1534)
	at java.base/java.lang.ClassLoader$1.run(ClassLoader.java:680)
	at java.base/java.lang.ClassLoader$1.run(ClassLoader.java:678)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.lang.ClassLoader.checkPackageAccess(ClassLoader.java:678)
	at java.base/java.lang.ClassLoader.defineClass2(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1098)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:206)
	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:760)
	at java.base/jdk.internal.loader.BuiltinClassLoader.lambda$findClassInModuleOrNull$2(BuiltinClassLoader.java:683)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassInModuleOrNull(BuiltinClassLoader.java:684)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findClass(BuiltinClassLoader.java:562)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:607)
	at java.base/java.lang.Class.forName(Class.java:451)
	at java.base/java.util.ServiceLoader.lambda$loadProvider$1(ServiceLoader.java:852)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.ServiceLoader.loadProvider(ServiceLoader.java:854)
	at java.base/java.util.ServiceLoader.access$600(ServiceLoader.java:390)
	at java.base/java.util.ServiceLoader$ModuleServicesLookupIterator.hasNext(ServiceLoader.java:1071)
	at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1294)
	at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1379)
	at java.base/java.lang.Iterable.forEach(Iterable.java:74)
	at java.management/java.lang.management.ManagementFactory$PlatformMBeanFinder.lambda$static$0(ManagementFactory.java:925)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:429)
	at java.management/java.lang.management.ManagementFactory$PlatformMBeanFinder.(ManagementFactory.java:921)
	... 9 more

Comments
New exception trace in mach5-one-jdk10-hs-nightly-all-2017-10-23-7-20171023-2013-3388 ----------System.out:(2/90)---------- ---MemoryMXBeanTest-main starting ...... ---MemoryMXBeanTest-main security setting ...... ----------System.err:(49/4038)---------- java.util.ServiceConfigurationError: sun.management.spi.PlatformMBeanProvider: Unable to load org.graalvm.compiler.hotspot.jmx.GraalMBeans at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:581) at java.base/java.util.ServiceLoader.loadProvider(ServiceLoader.java:862) at java.base/java.util.ServiceLoader.access$600(ServiceLoader.java:390) at java.base/java.util.ServiceLoader$ModuleServicesLookupIterator.hasNext(ServiceLoader.java:1076) at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1299) at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1384) at java.base/java.lang.Iterable.forEach(Iterable.java:74) at java.management/java.lang.management.ManagementFactory$PlatformMBeanFinder.lambda$static$0(ManagementFactory.java:925) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.AccessController.doPrivileged(AccessController.java:429) at java.management/java.lang.management.ManagementFactory$PlatformMBeanFinder.<clinit>(ManagementFactory.java:921) at java.management/java.lang.management.ManagementFactory.getPlatformMXBean(ManagementFactory.java:684) at java.management/java.lang.management.ManagementFactory.getMemoryMXBean(ManagementFactory.java:343) at MemoryMXBeanTest.main(MemoryMXBeanTest.java:41) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:115) at java.base/java.lang.Thread.run(Thread.java:844) Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.sun.management.spi") at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) at java.base/java.security.AccessController.checkPermission(AccessController.java:895) at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:558) at java.base/java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1534) at java.base/java.lang.ClassLoader$1.run(ClassLoader.java:680) at java.base/java.lang.ClassLoader$1.run(ClassLoader.java:678) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.lang.ClassLoader.checkPackageAccess(ClassLoader.java:678) at java.base/java.lang.ClassLoader.defineClass2(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1098) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:206) at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:760) at java.base/jdk.internal.loader.BuiltinClassLoader.lambda$findClassInModuleOrNull$2(BuiltinClassLoader.java:683) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/jdk.internal.loader.BuiltinClassLoader.findClassInModuleOrNull(BuiltinClassLoader.java:684) at java.base/jdk.internal.loader.BuiltinClassLoader.findClass(BuiltinClassLoader.java:562) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:607) at java.base/java.lang.Class.forName(Class.java:451) at java.base/java.util.ServiceLoader.lambda$loadProvider$1(ServiceLoader.java:856) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.util.ServiceLoader.loadProvider(ServiceLoader.java:858) ... 18 more JavaTest Message: Test threw exception: java.util.ServiceConfigurationError: sun.management.spi.PlatformMBeanProvider: Unable to load org.graalvm.compiler.hotspot.jmx.GraalMBeans JavaTest Message: shutting down test STATUS:Failed.`main' threw exception: java.util.ServiceConfigurationError: sun.management.spi.PlatformMBeanProvider: Unable to load org.graalvm.compiler.hotspot.jmx.GraalMBeans
23-10-2017

The failure still happened after JDK-8189193 has been integrated into jdk10-hs. I am attaching a new failure log (MemoryMXBeanTest.mach5-one-jdk10-hs-nightly-all-2017-10-23-7-20171023-2013-3388.log)
23-10-2017

This is a duplicate of JDK-8189193.
19-10-2017

Note, JDK-8188775 was fixed 2017-10-06. These failures are from 2017-09-28. So it could indeed related to JDK-8188775. But failed exceptions don't show which packages or modules are causing it so it is difficult to say if it is really JDK-8188775: Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.sun.management.spi")
13-10-2017

Please see if this bug is similar to JDK-8188775
13-10-2017

All the tests are failing with below Exception java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.sun.management.spi") Tests started failing after fixing https://bugs.openjdk.java.net/browse/JDK-8182701 changeset link : http://hg.openjdk.java.net/jdk10/hs/rev/8b2054b7d02c
13-10-2017

we can add these tests to problem list if needed.
11-10-2017

will fix it as soon as possible.
11-10-2017

So how do we fix this, or can we put this on the problem list? We all don't need to click on this every time we run tests. thanks.
10-10-2017