gpt4 book ai didi

在 jvisulavm 中添加 JMXConnection 时出现 java.lang.SecurityException

转载 作者:太空宇宙 更新时间:2023-11-04 10:24:36 24 4
gpt4 key购买 nike

各位开发人员大家好,

我尝试使用 jvisualvm 打开与应用程序的 jmx 连接,但是当我添加连接时,它失败并出现 SecurityException。谁能帮我弄清楚如何避免这种情况?

完整堆栈跟踪

SEVERE [org.openide.util.RequestProcessor]: Error in RequestProcessor com.sun.tools.visualvm.jmx.impl.AddJMXConnectionAction$1java.lang.SecurityException: attempt to add a Permission to a readonly Permissions object        at java.security.Permissions.add(Permissions.java:126)        at java.security.Policy$UnsupportedEmptyCollection.add(Policy.java:827)        at sun.rmi.server.LoaderHandler.getLoaderAccessControlContext(LoaderHandler.java:1005)        at sun.rmi.server.LoaderHandler.lookupLoader(LoaderHandler.java:881)        at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:404)        at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:186)        at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:637)        at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:264)        at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:219)        at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1866)        at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1749)        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2040)        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1571)        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:431)        at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:322)        at sun.rmi.server.UnicastServerRef.unmarshalParametersUnchecked(UnicastServerRef.java:628)        at sun.rmi.server.UnicastServerRef.unmarshalParameters(UnicastServerRef.java:616)        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:338)        at sun.rmi.transport.Transport$1.run(Transport.java:200)        at sun.rmi.transport.Transport$1.run(Transport.java:197)        at java.security.AccessController.doPrivileged(Native Method)        at sun.rmi.transport.Transport.serviceCall(Transport.java:196)        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:835)        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)        at java.security.AccessController.doPrivileged(Native Method)        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)        at java.lang.Thread.run(Thread.java:748)        at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:283)        at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:260)        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161)        at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)        at javax.management.remote.rmi.RMIConnectionImpl_Stub.isInstanceOf(Unknown Source)        at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.isInstanceOf(RMIConnector.java:1100)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)        at java.lang.reflect.Method.invoke(Method.java:498)        at com.sun.tools.visualvm.jmx.impl.JmxModelImpl$CheckerInvocationHandler.invoke(JmxModelImpl.java:655)        at com.sun.proxy.$Proxy11.isInstanceOf(Unknown Source)        at java.lang.management.ManagementFactory.newPlatformMXBeanProxy(ManagementFactory.java:617)        at com.sun.tools.visualvm.tools.jmx.JvmMXBeansFactory$JvmMXBeansImpl.getMXBean(JvmMXBeansFactory.java:363)        at com.sun.tools.visualvm.tools.jmx.JvmMXBeansFactory$JvmMXBeansImpl.getRuntimeMXBean(JvmMXBeansFactory.java:336)        at com.sun.tools.visualvm.jmx.impl.JmxApplication.getPid(JmxApplication.java:64)        at com.sun.tools.visualvm.jvmstat.JvmstatModelProvider.getMonitoredVm(JvmstatModelProvider.java:29)        at com.sun.tools.visualvm.jvmstat.JvmstatModelProvider.createModelFor(JvmstatModelProvider.java:51)        at com.sun.tools.visualvm.jvmstat.JvmstatModelProvider.createModelFor(JvmstatModelProvider.java:25)        at com.sun.tools.visualvm.core.model.ModelFactory.getModel(ModelFactory.java:91)        at com.sun.tools.visualvm.tools.jvmstat.JvmstatModelFactory.getJvmstatFor(JvmstatModelFactory.java:45)        at com.sun.tools.visualvm.jvm.JRockitJvmProvider.createModelFor(JRockitJvmProvider.java:29)        at com.sun.tools.visualvm.jvm.JRockitJvmProvider.createModelFor(JRockitJvmProvider.java:22)        at com.sun.tools.visualvm.core.model.ModelFactory.getModel(ModelFactory.java:91)        at com.sun.tools.visualvm.application.jvm.JvmFactory.getJVMFor(JvmFactory.java:45)        at com.sun.tools.visualvm.jmx.impl.JmxApplicationProvider.addJmxApplication(JmxApplicationProvider.java:303)        at com.sun.tools.visualvm.jmx.impl.JmxApplicationProvider.createJmxApplication(JmxApplicationProvider.java:186)        at com.sun.tools.visualvm.jmx.JmxApplicationsSupport.createJmxApplicationImpl(JmxApplicationsSupport.java:299)        at com.sun.tools.visualvm.jmx.JmxApplicationsSupport.createJmxApplicationInteractive(JmxApplicationsSupport.java:276)        at com.sun.tools.visualvm.jmx.impl.AddJMXConnectionAction$1.run(AddJMXConnectionAction.java:60)        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1384)[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1994)

感谢任何帮助。

最佳答案

您的应用代码中是否有 SecurityManager?

@Override
public PermissionCollection getPermissions(ProtectionDomain domain) {}

可以返回不可变列表。就我而言,这导致了同样的异常。

关于在 jvisulavm 中添加 JMXConnection 时出现 java.lang.SecurityException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50689365/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com