Java任务控制 - 无法启动录像机

时间:2016-04-26 11:55:57

标签: java jmc

java.lang.RuntimeException: Access denied! Invalid access level for requested MBeanServer operation.
    at com.jrockit.mc.flightrecorder.controlpanel.ui.FlightRecorderProvider.refresh(FlightRecorderProvider.java:110)
    at com.jrockit.mc.browser.views.JVMBrowserView$1.run(JVMBrowserView.java:100)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.SecurityException: Access denied! Invalid access level for requested MBeanServer operation.
    at com.sun.jmx.remote.security.MBeanServerFileAccessController.checkAccess(MBeanServerFileAccessController.java:344)
    at com.sun.jmx.remote.security.MBeanServerFileAccessController.checkCreate(MBeanServerFileAccessController.java:249)
    at com.sun.jmx.remote.security.MBeanServerAccessController.createMBean(MBeanServerAccessController.java:177)
    at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1421)
    at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1406)
    at javax.management.remote.rmi.RMIConnectionImpl.createMBean(RMIConnectionImpl.java:255)
    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:497)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
    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:568)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$251(TCPTransport.java:683)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$$Lambda$2/6736119.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:276)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:253)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:162)
    at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
    at javax.management.remote.rmi.RMIConnectionImpl_Stub.createMBean(Unknown Source)
    at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.createMBean(RMIConnector.java:651)
    at com.jrockit.mc.rjmx.internal.MCMBeanServerConnection.createMBean(MCMBeanServerConnection.java:66)
    at com.jrockit.mc.rjmx.services.internal.HotspotManagementToolkit.registerMBeans(HotspotManagementToolkit.java:50)
    at com.jrockit.mc.rjmx.services.flr.internal.FlightRecorderCommunicationHelper.getAttribute(FlightRecorderCommunicationHelper.java:39)
    at com.jrockit.mc.rjmx.services.flr.internal.FlightRecorderService.getAvailableRecordings(FlightRecorderService.java:196)
    at com.jrockit.mc.flightrecorder.controlpanel.ui.FlightRecorderProvider.refreshRecordings(FlightRecorderProvider.java:128)
    at com.jrockit.mc.flightrecorder.controlpanel.ui.FlightRecorderProvider.refresh(FlightRecorderProvider.java:99)
    ... 8 more
Caused by: java.lang.SecurityException: Access property for this identity should be similar to: readwrite create com.sun.management.MissionControl
    at com.sun.jmx.remote.security.MBeanServerFileAccessController.checkAccess(MBeanServerFileAccessController.java:352)
    at com.sun.jmx.remote.security.MBeanServerFileAccessController.checkCreate(MBeanServerFileAccessController.java:249)
    at com.sun.jmx.remote.security.MBeanServerAccessController.createMBean(MBeanServerAccessController.java:177)
    at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1421)
    at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1406)
    at javax.management.remote.rmi.RMIConnectionImpl.createMBean(RMIConnectionImpl.java:255)
    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:497)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
    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:568)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$251(TCPTransport.java:683)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$$Lambda$2/6736119.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
    ... 3 more

我尝试连接以使用JMC删除服务器。启动飞行记录器后得到以下堆栈跟踪。同时,我能够在JMC中启动JMX控制台,我可以看到所有数据(内存,CPU等)。

我使用controlRole连接

controlRole   readwrite \
              create javax.management.monitor.*,javax.management.timer.* \
              unregister

有任何线索吗?

是否因为我在启动的应用程序中缺少以下键?试图连接到没有以下键运行的本地应用程序,工作正常

-XX:+UnlockCommercialFeatures -XX:+FlightRecorder

更新 - 上面添加的JVM选项无效

1 个答案:

答案 0 :(得分:3)

<your-role-name-goes-here> readwrite \
  create com.sun.management.*,com.oracle.jrockit.* \
  unregister

必须修改jmxremote.access。 JMC需要特殊许可 - https://community.oracle.com/thread/2588377