Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8014008

SecurityException: attempt to add a Permission to a readonly Permissions object

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3
    • None
    • 6u24, 6u38, 7u21, 8u281
    • core-libs

    Description

      FULL PRODUCT VERSION :
      java version " 1.6.0_24 "
      Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
      Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)

      java version " 1.6.0_38 "
      Java(TM) SE Runtime Environment (build 1.6.0_38-b05)
      Java HotSpot(TM) Client VM (build 20.13-b02, mixed mode, sharing)

      java version " 1.7.0_21 "
      Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
      Java HotSpot(TM) Client VM (build 23.21-b01, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.0.6002] (Client...where visualvm is being executed)
      SunOS ocie 5.10 Generic_147441-09 i86pc i386 i86pc (Server where process to be monitored is running)


      EXTRA RELEVANT SYSTEM CONFIGURATION :
      I tried this running with a rather standard setup, and again using a SOCKS proxy through a SSH tunnel.

      A DESCRIPTION OF THE PROBLEM :
      I am trying to run jvisualvm remotely and am having no luck. When I run it on my laptop, connecting to a server I get the permissions error below.

      I added some Thread.sleeps in my code to coordinate my efforts, and it seems to be dying at the same place (or near) every time, and I think it may have something to do with a 3rd party library I am using. (A commerical library I cannot provide you with.) However, I cannot figure out why my visualvm (both the one included in the JDKs and 1.3.5 that I downloaded separately) fails; I would think that a monitored program could not cause visualVM (on another computer) to fail. This happens both with 6_38, 6_24, and 7_21

      I was hoping that by looking at the stack trace, it could be determined what I going on. I have the stacks for 6_38, 6_24, and 7_21. All seem to be exactly the same.

      Stack trace using 6_38

      java.lang.SecurityException: attempt to add a Permission to a readonly Permissions object
      at java.security.Permissions.add(Permissions.java:127)
      at java.security.Policy$UnsupportedEmptyCollection.add(Policy.java:837)
      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:184)
      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:222)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1610)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1515)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
      at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:307)
      at sun.rmi.transport.Transport$1.run(Transport.java:177)
      at sun.rmi.transport.Transport$1.run(Transport.java:174)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:722)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
      at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
      at javax.management.remote.rmi.RMIConnectionImpl_Stub.getAttribute(Unknown Source)
      at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.getAttribute(RMIConnector.java:878)
      at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.sun.tools.visualvm.jmx.impl.JmxModelImpl$CheckerInvocationHandler.invoke(JmxModelImpl.java:598)
      at $Proxy8.getAttribute(Unknown Source)
      at com.sun.jmx.mbeanserver.MXBeanProxy$GetHandler.invoke(MXBeanProxy.java:106)
      at com.sun.jmx.mbeanserver.MXBeanProxy.invoke(MXBeanProxy.java:148)
      at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:248)
      at $Proxy9.getUptime(Unknown Source)
      at com.sun.tools.visualvm.jvm.MonitoredDataImpl.<init>(MonitoredDataImpl.java:90)
      at com.sun.tools.visualvm.jvm.JmxSupport$1.run(JmxSupport.java:246)
      at java.util.TimerThread.mainLoop(Timer.java:512)

      Stack trace using 7_21
      java.lang.SecurityException: attempt to add a Permission to a readonly Permissions object
      at java.security.Permissions.add(Permissions.java:127)
      at java.security.Policy$UnsupportedEmptyCollection.add(Policy.java:837)
      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:184)
      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:222)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1610)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1515)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
      at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:307)
      at sun.rmi.transport.Transport$1.run(Transport.java:177)
      at sun.rmi.transport.Transport$1.run(Transport.java:174)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:722)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:273)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:251)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:160)
      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:1097)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at com.sun.tools.visualvm.jmx.impl.JmxModelImpl$CheckerInvocationHandler.invoke(JmxModelImpl.java:598)
      at com.sun.proxy.$Proxy8.isInstanceOf(Unknown Source)
      at java.lang.management.ManagementFactory.newPlatformMXBeanProxy(ManagementFactory.java:597)
      at com.sun.tools.visualvm.tools.jmx.JvmMXBeansFactory$JvmMXBeansImpl.getMXBean(JvmMXBeansFactory.java:383)
      at com.sun.tools.visualvm.tools.jmx.JvmMXBeansFactory$JvmMXBeansImpl.getRuntimeMXBean(JvmMXBeansFactory.java:356)
      at com.sun.tools.visualvm.jmx.impl.JmxApplication.getPid(JmxApplication.java:84)
      at com.sun.tools.visualvm.jvmstat.JvmstatModelProvider.getMonitoredVm(JvmstatModelProvider.java:49)
      at com.sun.tools.visualvm.jvmstat.JvmstatModelProvider.createModelFor(JvmstatModelProvider.java:71)
      at com.sun.tools.visualvm.jvmstat.JvmstatModelProvider.createModelFor(JvmstatModelProvider.java:45)
      at com.sun.tools.visualvm.core.model.ModelFactory.getModel(ModelFactory.java:111)
      at com.sun.tools.visualvm.tools.jvmstat.JvmstatModelFactory.getJvmstatFor(JvmstatModelFactory.java:65)
      at com.sun.tools.visualvm.jvm.JRockitJvmProvider.createModelFor(JRockitJvmProvider.java:49)
      at com.sun.tools.visualvm.jvm.JRockitJvmProvider.createModelFor(JRockitJvmProvider.java:42)
      at com.sun.tools.visualvm.core.model.ModelFactory.getModel(ModelFactory.java:111)
      at com.sun.tools.visualvm.application.jvm.JvmFactory.getJVMFor(JvmFactory.java:65)
      at com.sun.tools.visualvm.jmx.impl.JmxApplicationProvider.addJmxApplication(JmxApplicationProvider.java:305)
      at com.sun.tools.visualvm.jmx.impl.JmxApplicationProvider.access$100(JmxApplicationProvider.java:74)
      at com.sun.tools.visualvm.jmx.impl.JmxApplicationProvider$3$1.run(JmxApplicationProvider.java:422)
      at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1452)
      [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2032)

      Stack using 6_24
      java.lang.SecurityException: attempt to add a Permission to a readonly Permissions object
      at java.security.Permissions.add(Permissions.java:127)
      at java.security.Policy$UnsupportedEmptyCollection.add(Policy.java:837)
      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:184)
      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:222)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1610)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1515)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
      at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:307)
      at sun.rmi.transport.Transport$1.run(Transport.java:177)
      at sun.rmi.transport.Transport$1.run(Transport.java:174)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:722)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
      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:1073)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.sun.tools.visualvm.jmx.impl.JmxModelImpl$CheckerInvocationHandler.invoke(JmxModelImpl.java:599)
      at $Proxy7.isInstanceOf(Unknown Source)
      at java.lang.management.ManagementFactory.newPlatformMXBeanProxy(ManagementFactory.java:616)
      at com.sun.tools.visualvm.tools.jmx.JvmMXBeansFactory$JvmMXBeansImpl.getMXBean(JvmMXBeansFactory.java:383)
      at com.sun.tools.visualvm.tools.jmx.JvmMXBeansFactory$JvmMXBeansImpl.getRuntimeMXBean(JvmMXBeansFactory.java:356)
      at com.sun.tools.visualvm.jmx.impl.JmxApplication.getPid(JmxApplication.java:84)
      at com.sun.tools.visualvm.jvmstat.JvmstatModelProvider.getMonitoredVm(JvmstatModelProvider.java:49)
      at com.sun.tools.visualvm.jvmstat.JvmstatModelProvider.createModelFor(JvmstatModelProvider.java:71)
      at com.sun.tools.visualvm.jvmstat.JvmstatModelProvider.createModelFor(JvmstatModelProvider.java:45)
      at com.sun.tools.visualvm.core.model.ModelFactory.getModel(ModelFactory.java:111)
      at com.sun.tools.visualvm.tools.jvmstat.JvmstatModelFactory.getJvmstatFor(JvmstatModelFactory.java:65)
      at com.sun.tools.visualvm.jvm.JRockitJvmProvider.createModelFor(JRockitJvmProvider.java:49)
      at com.sun.tools.visualvm.jvm.JRockitJvmProvider.createModelFor(JRockitJvmProvider.java:42)
      at com.sun.tools.visualvm.core.model.ModelFactory.getModel(ModelFactory.java:111)
      at com.sun.tools.visualvm.application.jvm.JvmFactory.getJVMFor(JvmFactory.java:65)
      at com.sun.tools.visualvm.jmx.impl.JmxApplicationProvider.addJmxApplication(JmxApplicationProvider.java:292)
      at com.sun.tools.visualvm.jmx.impl.JmxApplicationProvider.createJmxApplication(JmxApplicationProvider.java:185)
      at com.sun.tools.visualvm.jmx.JmxApplicationsSupport.createJmxApplicationImpl(JmxApplicationsSupport.java:286)
      at com.sun.tools.visualvm.jmx.JmxApplicationsSupport.createJmxApplicationInteractive(JmxApplicationsSupport.java:263)
      at com.sun.tools.visualvm.jmx.impl.AddJMXConnectionAction$1.run(AddJMXConnectionAction.java:80)
      at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      I run my server process, then attach to it from my laptop. It works at the beginning and then just stops working. If I wait to attach until after the " failure point " , the error will happen immediately.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      jvisualvm and VisualVM to work
      ACTUAL -
      jvisualvm and VisualVM dies

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.lang.SecurityException: attempt to add a Permission to a readonly Permissions object
      at java.security.Permissions.add(Permissions.java:127)
      at java.security.Policy$UnsupportedEmptyCollection.add(Policy.java:837)
      at sun.rmi.server.LoaderHandler.getLoaderAccessControlContext(LoaderHandler.java:1005)


      REPRODUCIBILITY :
      This bug can be reproduced often.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated: