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

Update RMI specifications to reflect modularization changes

    Details

    • Subcomponent:
    • Resolved In Build:
      b157
    • Verification:
      Not verified

      Backports

        Description


        RMI will require changes to work with modules. This issue requests that the changes be scoped and sized. It may be that there are only small changes required but it might require some API/javadoc changes too.

        Here is one example to consider:

        import javax.management.MBeanServer;
        import javax.management.MBeanServerFactory;
        import javax.management.remote.JMXConnectorServer;
        import javax.management.remote.JMXConnectorServerFactory;
        import javax.management.remote.JMXServiceURL;

        public class StubbsGazette {
            public static void main(String[] args) throws Exception {
                JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://host");
                MBeanServer mbs = MBeanServerFactory.createMBeanServer();
                JMXConnectorServer server = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs);
                server.start();
            }
        }


        $ java StubbsGazette
        Exception in thread "main" java.rmi.StubNotFoundException: Stub class constructor not public: javax.management.remote.rmi.RMIServerImpl_Stub; nested exception is:
        java.lang.IllegalAccessException: Class sun.rmi.server.Util (module java.rmi) can not access a member of class javax.management.remote.rmi.RMIServerImpl_Stub (module java.management) with modifiers "public"
        at sun.rmi.server.Util.createStub(Util.java:303)
        at sun.rmi.server.Util.createProxy(Util.java:139)
        at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:195)
        at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:383)
        at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:346)
        at javax.management.remote.rmi.RMIJRMPServerImpl.export(RMIJRMPServerImpl.java:118)
        at javax.management.remote.rmi.RMIJRMPServerImpl.export(RMIJRMPServerImpl.java:95)
        at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:404)
        at StubbsGazette.main(StubbsGazette.java:12)
        Caused by: java.lang.IllegalAccessException: Class sun.rmi.server.Util (module java.rmi) can not access a member of class javax.management.remote.rmi.RMIServerImpl_Stub (module java.management) with modifiers "public"
        at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:142)
        at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:295)
        at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:287)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:399)
        at sun.rmi.server.Util.createStub(Util.java:291)
        ... 8 more

        In this example then the exporting of the stub fails because the RMI module cannot read the management module. This may be a case where the Core Reflection usage needs to change so that RMI does the access check and suppresses the check (via setAccessible) when creating the stub.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  smarks Stuart Marks
                  Reporter:
                  alanb Alan Bateman
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Due:
                    Created:
                    Updated:
                    Resolved: