JDK-6619366 : javax.management.remote.rmi.RMIConnector.getConnection code relies on non-compliant behaviour of ORB
  • Type: Bug
  • Component: core-svc
  • Sub-Component: javax.management
  • Affected Version: 6
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_9
  • CPU: other
  • Submitted: 2007-10-19
  • Updated: 2011-01-04
  • Resolved: 2007-11-02
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 Other
6u4 b07Fixed tbdResolved
Related Reports
Relates :  
Description
OPERATING SYSTEM(S):
SunOS 5.10

FULL JDK VERSION(S):
java version "1.6.0_03-ea"
Java(TM) 2 Runtime Environment, Standard Edition (IBM build 1.6.0_03-ea-b02 03_Oct_2007_05_32)
Java HotSpot(TM) Server VM (build 1.6.0_03-ea-b02, mixed mode)

DESCRIPTION:

The javax.management.remote.rmi.RMIConnector.getConnection code relies on non-compliant behaviour of the ORB which causes JCK failures in the IBM Hybrid builds.

Failing testcases:

api/javax_management/remote/loading/index.html#RmiIiopClientDefaultClassLoaderTest[JMXConnectorFactory0002]
api/javax_management/remote/loading/index.html#RmiIiopClientDefaultClassLoaderTest[JMXConnectorFactory0003]
api/javax_management/remote/loading/index.html#RmiIiopClientDefaultClassLoaderTest[JMXConnectorFactory0004]
api/javax_management/remote/loading/index.html#RmiIiopClientDefaultClassLoaderTest[JMXConnectorFactory0005]
api/javax_management/remote/loading/index.html#RmiIiopClientDefaultClassLoaderTest[JMXConnectorFactory0006]
api/javax_management/remote/security/index.html#RmiIiopMBeanServerForwarderTest
api/javax_management/remote/JMXConnector/index.html#IIOPConnectorTest[ConnectorConnect009]
api/javax_management/remote/security/index.html#RmiIiopMBeanServerConnectionTest[getMBeanInfo0001]
api/javax_management/remote/loading/index.html#RmiIiopServerDefaultClassLoaderTest[JMXConnectorServerFactory0004]
api/javax_management/remote/loading/index.html#RmiIiopServerDefaultClassLoaderTest[JMXConnectorServerFactory0005]
api/javax_management/remote/loading/index.html#RmiIiopServerDefaultClassLoaderTest[JMXConnectorServerFactory0006]
api/javax_management/remote/loading/index.html#RmiIiopServerDefaultClassLoaderTest[JMXConnectorServerFactory0007]
api/javax_management/remote/security/index.html#RmiIiopSubjectDelegationTest[SubjectDelegationTest0004]
api/javax_management/remote/security/index.html#RmiIiopSubjectDelegationTest[SubjectDelegationTest0005]
api/javax_management/remote/security/index.html#RmiIiopSubjectDelegationTest[SubjectDelegationTest0007]
api/javax_management/remote/security/index.html#RmiIiopSubjectDelegationTest[SubjectDelegationTest0008]
api/javax_management/remote/security/index.html#RmiIiopSubjectDelegationTest[SubjectDelegationTest0009]
api/javax_management/remote/rmi/RMIConnection/index.html#RMIConnectionTest[RMIConnectionTest0003]

In the test case, a JMXConnectorServer, say server is created by calling JMXConnectorServerFactory.newJMXConnectorServer(). A Connection Stub client is created by calling server.toJMXConnector(). Then there is a call to client.connect().

The connector stub is a JMXConnector, but since this is a remote case, the connector stub is of type RMIConnector (implementing the JMXConnector interface).

Through the connect() method, the IBM ORB looks up for the javax.management.remote.rmi._RMIConnection_Stub class. 

The stubClass loaded by the IBM ORB is of type

    javax.management.remote.rmi._RMIConnection_Stub

but the RMIConnector.getConnection code is expecting a

    org.omg.stub.javax.management.remote.rmi._RMIConnection_Stub. 

Therefore the comparison

    if (c.getClass().getName().equals(iiopConnectionStubClassName))

fails and shadowIiopStub is not called. Subsequently, the test fails with several failures.

The lookup for the javax.management.remote.rmi._RMIConnection_Stub is compliant with the Java2IDL specification. As per section 1.4.6 of the Java 2 IDL specification, the ORB should use the following logic to decide which stub class to load:

 "When loading a stub class corresponding to an interface or class
<packagename>.<typename>, the class <packagename>._<typename>_Stub shall be used if it exists; otherwise, the class org.omg.stub.<packagename>._<typename>_Stub shall be used."

SUN has provided both versions of the _RMIConnection_Stub class in rt.jar. The stubClass loaded by the Sun ORB is of type org.omg.stub.javax.management.remote.rmi._RMIConnection_Stub and not javax.management.remote.rmi._RMIConnection_Stub. This is not compliant as per the java2IDL spec, so the behaviour of the Sun ORB is incorrect.

The IBM ORB loads the javax.management.remote.rmi._RMIConnection_Stub in a spec compliant manner, resulting in the failures.

Note that in a similar manner Sun also ships two versions of the _RMIServer_Stub class. This has not us caused any problems so far, but we feel it is worth a mention in case it could cause similar problems in the future.

The jtr failure reports have been provided to Dave Korbel.

Comments
EVALUATION Plainly we should check the stub class name against both "org.omg.stub.javax.management.remote.rmi._RMIConnection_Stub" and "javax.management.remote.rmi._RMIConnection_Stub", rather than just the former as at present. This should also futureproof the IIOP connector against a possible change to the JDK ORB that would respect the spec language quoted.
22-10-2007

SUGGESTED FIX Replace iiopConnectionStubClassName with: private static final List<String> iiopConnectionStubClassNames = Arrays.asList( "org.omg.stub.javax.management.remote.rmi._RMIConnection_Stub", "javax.management.remote.rmi._RMIConnection_Stub" ); and change if (c.getClass().getName().equals(iiopConnectionStubClassName)) to if (iiopConnectionStubClassNames.contains(c.getClass().getName())
22-10-2007