我们最近将应用程序迁移到 java 11,并且在使用 jmx 访问 mbean 时遇到问题。我们使用JDK Mission Control和jmx term(https://docs.cyclopsgroup.org/welcome,它是基于jconsole)来访问。 MBean 通过 Spring (5.2.5.RELEASE) 公开。
相同的功能在 java 7 上运行良好,看起来它可以在 java11 采用jdk 上运行(在相同条件下未完全验证,仅在应用程序在 Intellij 中运行时进行检查)。
这可能是我们用来运行的语言环境存在问题,但更改语言环境没有任何区别。
环境: 爪哇: openjdk 版本“11.0.13”2021-10-19 LTS OpenJDK 运行时环境 18.9(内部版本 11.0.13+8-LTS) OpenJDK 64位服务器VM 18.9(构建11.0.13+8-LTS,混合模式,共享) 供应商是 RedHat
Linux: NAME=“红帽企业 Linux 服务器” 版本=“7.9(麦婆)”
区域设置:
LANG=C
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=
例外:
javax.management.RuntimeMBeanException: java.util.MissingResourceException: Can't find bundle for base name sun.security.util.Resources, locale en_US
at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.rethrow(DefaultMBeanServerInterceptor.java:829)
at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.rethrowMaybeMBeanException(DefaultMBeanServerInterceptor.java:842)
at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:811)
at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1466)
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1406)
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:827)
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:566)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
at java.rmi/sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:303)
at java.rmi/sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:279)
at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161)
at jdk.remoteref/jdk.jmx.remote.internal.rmi.PRef.invoke(Unknown Source)
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl_Stub.invoke(Unknown Source)
at java.management.rmi/javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.invoke(RMIConnector.java:1021)
at org.openjdk.jmc.rjmx.internal.MCMBeanServerConnection.invoke(MCMBeanServerConnection.java:258)
at org.openjdk.jmc.rjmx.internal.MBeanOperationWrapper$1.call(MBeanOperationWrapper.java:104)
at org.openjdk.jmc.rjmx.ui.operations.ExecuteOperationForm$4.run(ExecuteOperationForm.java:182)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.util.MissingResourceException: Can't find bundle for base name sun.security.util.Resources, locale en_US
at java.base/java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:2055)
at java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1689)
at java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1582)
at java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1556)
at java.base/java.util.ResourceBundle.getBundle(ResourceBundle.java:857)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
at java.base/sun.security.util.ResourcesMgr.getBundle(ResourcesMgr.java:54)
at java.base/sun.security.util.ResourcesMgr.getString(ResourcesMgr.java:40)
at java.base/javax.security.auth.Subject.collectionNullClean(Subject.java:1004)
at java.base/javax.security.auth.Subject$SecureSet.containsAll(Subject.java:1279)
at java.base/javax.security.auth.Subject$SecureSet.equals(Subject.java:1382)
at java.base/java.util.Collections$SynchronizedSet.equals(Collections.java:2143)
at java.base/javax.security.auth.SubjectDomainCombiner.combine(SubjectDomainCombiner.java:196)
at java.management/com.sun.jmx.remote.security.JMXSubjectDomainCombiner.combine(JMXSubjectDomainCombiner.java:71)
at java.base/java.security.AccessControlContext.optimize(AccessControlContext.java:608)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.getCombinedACC(ProtectionDomain.java:109)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.management/javax.management.modelmbean.RequiredModelMBean.resolveMethod(RequiredModelMBean.java:1047)
at java.management/javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:1005)
at org.springframework.jmx.export.SpringModelMBean.invoke(SpringModelMBean.java:90)
at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:809)
at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1466)
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1406)
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:827)
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:566)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalStateException: Recursive update
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1760)
at java.base/sun.security.util.ResourcesMgr.getBundle(ResourcesMgr.java:54)
at java.base/sun.security.util.ResourcesMgr.getString(ResourcesMgr.java:40)
at java.base/javax.security.auth.Subject.collectionNullClean(Subject.java:1004)
at java.base/javax.security.auth.Subject$SecureSet.containsAll(Subject.java:1279)
at java.base/javax.security.auth.Subject$SecureSet.equals(Subject.java:1382)
at java.base/java.util.Collections$SynchronizedSet.equals(Collections.java:2143)
at java.base/javax.security.auth.SubjectDomainCombiner.combine(SubjectDomainCombiner.java:196)
at java.management/com.sun.jmx.remote.security.JMXSubjectDomainCombiner.combine(JMXSubjectDomainCombiner.java:71)
at java.base/java.security.AccessControlContext.optimize(AccessControlContext.java:608)
at java.base/java.security.AccessController.getContext(AccessController.java:839)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:424)
at java.base/java.util.ResourceBundle$ResourceBundleProviderHelper.loadResourceBundle(ResourceBundle.java:3602)
at java.base/java.util.ResourceBundle.loadBundle(ResourceBundle.java:1844)
at java.base/java.util.ResourceBundle.findBundle(ResourceBundle.java:1774)
at java.base/java.util.ResourceBundle.findBundle(ResourceBundle.java:1728)
at java.base/java.util.ResourceBundle.findBundle(ResourceBundle.java:1728)
at java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1662)
... 42 more
我也有同样的问题,你解决了吗?