-
Enhancement
-
Resolution: Fixed
-
P3
-
None
-
b157
-
Not verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8175712 | 10 | Stuart Marks | P3 | Resolved | Fixed | b02 |
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.
- backported by
-
JDK-8175712 Update RMI specifications to reflect modularization changes
-
- Resolved
-
- relates to
-
JDK-8146299 Disable rmic -Xnew
-
- Resolved
-
-
JDK-8165649 Re-examine if Activatable object can be created from non-public class and/or constructor
-
- Closed
-