JDK-6771107 : IIOP: Exception thrown is changed in 6u12
  • Type: Bug
  • Component: other-libs
  • Sub-Component: corba:orb
  • Affected Version: 6u12
  • Priority: P1
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_9
  • CPU: sparc
  • Submitted: 2008-11-13
  • Updated: 2011-01-20
  • Resolved: 2009-01-29
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
6u12 b03Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
When we fixed the jmx bug 6696028, we expected to receive "RemoteException" as thrown by the current existing JDK6 (for example 1.6.0_10), but we got NullPointerException from the 6u12.

This possibly impacts other existing applications, so important to run JCK to verify the compability.

Here is the test:
/*
 * @test IllegalIIOPURLTest.java 1.1 08/11/06
 * @bug 6696028
 * @summary JMXServiceURL like service:jmx:rmi:///jndi/iiop:// should be
 * rejected by the RMI conn provider.
 * @author Shanliang JIANG
 * @run clean IllegalIIOPURLTest
 * @run build IllegalIIOPURLTest
 * @run main IllegalIIOPURLTest
 */

import java.lang.management.ManagementFactory;


import java.net.MalformedURLException;
import javax.management.MBeanServer;

import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXConnectorServer;
import javax.management.remote.JMXConnectorServerFactory;
import javax.management.remote.JMXServiceURL;

public class IllegalIIOPURLTest {

    public static void main(String[] args) throws Exception {
        System.out.println(">>> Testing wrong url: service:jmx:rmi:///jndi/iiop:");

        final int port = 8686;
        Process orbd = null;
        JMXConnectorServer iiopServer = null;

        try {
            System.out.println(">>> Starting an orbd on the port " + port + "...");
            final String JAVA_HOME = System.getProperty("java.home");
            final String sep = System.getProperty("file.separator");
            final String cmd = JAVA_HOME + sep + "bin" + sep + "orbd -ORBInitialPort " + port;
            System.out.println(">>> Running " + cmd);
            orbd = Runtime.getRuntime().exec(cmd);
            Thread.sleep(100); // waiting orbd to complete starting
            final MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();

            JMXServiceURL addr = new JMXServiceURL(
                    "service:jmx:iiop:///jndi/iiop://:" + port + "/toto");

            System.out.println(">>> Started an IIOP server ...");
            iiopServer = JMXConnectorServerFactory.newJMXConnectorServer(addr,
                    null, mbeanServer);
            iiopServer.start();
            addr = iiopServer.getAddress();

            System.out.println(">>> Started an IIOP server on " + addr);

            JMXConnector conn = JMXConnectorFactory.connect(addr);
            conn.getMBeanServerConnection().getDefaultDomain();
            conn.close();

            JMXServiceURL wrongAddr = new JMXServiceURL(
                    "service:jmx:rmi:///jndi/iiop://:" + port + "/toto");
            System.out.println(">>> Starting a connector on wrong address: " +
                    wrongAddr);
            try {
                conn = JMXConnectorFactory.connect(wrongAddr);
            } catch (java.rmi.RemoteException re) {
                re.printStackTrace();
                throw new RuntimeException("The bug is not fixed!");
            } catch (MalformedURLException mfe) {
                System.out.println(">>> Got excepted exception: " + mfe);
                mfe.printStackTrace();
            }
        } finally {
            try {
                iiopServer.stop();
            } catch (Exception e1) {
                // OK
            }
            try {
                orbd.destroy();
            } catch (Exception e2) {
                // OK
            }
        }
    }
}
-----------------------------------
Here are the traces from 2 different versions:
----------
From 6u12:
Nov 12, 2008 2:51:22 PM com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl <init>
WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: localhost; port: 8686"
org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
       at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2200)
       at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2221)
       at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:205)
       at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:218)
       at com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:101)
       at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:152)
       at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:118)
       at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:211)
       at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
       at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
       at com.sun.jndi.cosnaming.CNCtx.setOrbAndRootContext(CNCtx.java:403)
       at com.sun.jndi.cosnaming.CNCtx.initUsingIiopUrl(CNCtx.java:291)
       at com.sun.jndi.cosnaming.CNCtx.initUsingUrl(CNCtx.java:260)
       at com.sun.jndi.cosnaming.CNCtx.createUsingURL(CNCtx.java:90)
       at com.sun.jndi.url.iiop.iiopURLContextFactory.getUsingURLIgnoreRest(iiopURLContextFactory.java:56)
       at com.sun.jndi.url.iiop.iiopURLContext.getRootURLContext(iiopURLContext.java:44)
       at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:182)
       at javax.naming.InitialContext.lookup(InitialContext.java:392)
       at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1886)
       at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1856)
       at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:257)
       at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
       at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:207)
       at IllegalIIOPURLTest.main(IllegalIIOPURLTest.java:54)
Caused by: java.lang.NullPointerException
       at com.sun.corba.se.impl.transport.DefaultSocketFactoryImpl.createSocket(DefaultSocketFactoryImpl.java:59)
       at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:188)
       ... 21 more
Exception in thread "main" java.lang.NullPointerException
       at com.sun.corba.se.impl.orb.ORBImpl.getInvocationInfo(ORBImpl.java:1737)
       at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.getClientRequestDispatcher(CorbaClientDelegateImpl.java:143)
       at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.releaseReply(CorbaClientDelegateImpl.java:136)
       at org.omg.CORBA.portable.ObjectImpl._releaseReply(ObjectImpl.java:474)
       at org.omg.stub.javax.management.remote.rmi._RMIServer_Stub.newClient(Unknown Source)
       at javax.management.remote.rmi.RMIConnector.getConnection(RMIConnector.java:2327)
       at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:279)
       at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
       at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:207)
       at IllegalIIOPURLTest.main(IllegalIIOPURLTest.java:54)

-------------------------
from java version "1.6.0_10"
java.rmi.RemoteException: CORBA BAD_OPERATION 1398079716 No; nested exception is:
       org.omg.CORBA.BAD_OPERATION:   vmcid: SUN  minor code: 228  completed: No
       at com.sun.corba.se.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:282)
       at javax.rmi.CORBA.Util.mapSystemException(Util.java:67)
       at org.omg.stub.javax.management.remote.rmi._RMIServer_Stub.newClient(Unknown Source)
       at javax.management.remote.rmi.RMIConnector.getConnection(RMIConnector.java:2327)
       at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:279)
       ... 3 more
Caused by: org.omg.CORBA.BAD_OPERATION:   vmcid: SUN  minor code: 228  completed: No
       at com.sun.corba.se.impl.logging.ORBUtilSystemException.orbDestroyed(ORBUtilSystemException.java:586)
       at com.sun.corba.se.impl.logging.ORBUtilSystemException.orbDestroyed(ORBUtilSystemException.java:608)
       at com.sun.corba.se.impl.orb.ORBImpl.checkShutdownState(ORBImpl.java:1289)
       at com.sun.corba.se.impl.orb.ORBImpl.create_any(ORBImpl.java:1078)
       at com.sun.corba.se.impl.javax.rmi.CORBA.Util.writeAny(Util.java:296)
       at javax.rmi.CORBA.Util.writeAny(Util.java:80)
       ... 6 more
Following JCK6b tests fails due to this:
pi/javax_management/remote/rmi/RMIConnector/IIOPAddNotificationListener.html#IIOPAddNotificationListener
api/javax_management/remote/rmi/RMIConnector/IIOPCredentialsTest.html#IIOPCredentialsTest
api/javax_management/remote/rmi/RMIConnector/IIOPGetMBeanServerConnectionTest.html#IIOPGetMBeanServerConnection
api/javax_management/remote/rmi/RMIConnector/IIOPRemoveConnectionNotificationListener.html#IIOPRemoveConnectionNotificationListener
api/javax_management/remote/rmi/RMIConnector/RMIConnectorToStringTest.html#RMIConnectorToStringTest
api/javax_management/remote/rmi/RMIConnectorServer/index.html#RMIConnectorServerAttachedMBSTest
api/javax_management/remote/JMXConnector/index.html#IIOPConnectorTest
api/javax_management/remote/JMXConnectorServerFactory/index.html#JMXConnectorServerFactoryTest
api/javax_management/remote/misc/concurrency/index.html#RmiIiopConcurrencyTest
api/javax_management/remote/misc/connectionId/index.html#RmiIiopConnectionIdTest

JCK            : JCK 6b b24
J2SE           : FAIL - jdk 6u12, PASS 6u11 
Platform[s]    : FAIL - any
switch/Mode    : FAIL - default

Steps to reproduce:
1. Install JDK 6u12 (for example to /export/jdk/jdk1.6.0_12/bin/java)
2. Install JCK6b (one could be found at /net/stt-13.russia/export/Links/stt/jck_promotions/6b/b24/binaries/JCK-runtime-6b)
3. Run command /export/jdk/jdk1.6.0_12/bin/tnameserv -ORBInitialPort 9999
4. Run the simple script:
#!/bin/bash

export JAVA=/export/jdk/jdk1.6.0_12/bin/java
export CLASSPATH="/net/stt-13.russia/export/Links/stt/jck_promotions/6b/b24/binaries/JCK-runtime-6b/classes"

OPTS=""
TOPTS="-runRmiRegistry -orbHost localhost -orbPort 9999"
TEST="\
javasoft.sqe.tests.api.javax.management.remote.rmi.RMIConnector.AddNotificationListener \
javasoft.sqe.tests.api.javax.management.remote.rmi.RMIConnector.Credentials \
javasoft.sqe.tests.api.javax.management.remote.rmi.RMIConnector.GetMBeanServerConnection \
javasoft.sqe.tests.api.javax.management.remote.rmi.RMIConnector.RemoveConnectionNotificationListener -TestCaseID removeConnectionNotificationListener0001 removeConnectionNotificati
javasoft.sqe.tests.api.javax.management.remote.rmi.RMIConnector.RMIConnectorToStringTest -TestCaseID RMIConnectorToStringIIOPTest0001 \
javasoft.sqe.tests.api.javax.management.remote.JMXConnector.JMXConnectorTest \
javasoft.sqe.tests.api.javax.management.remote.JMXConnectorServerFactory.JMXConnectorServerFactoryTest -TestCaseID newJMXConnectorServerTest0013 \
javasoft.sqe.tests.api.javax.management.remote.misc.concurrency.ConcurrencyTest \
javasoft.sqe.tests.api.javax.management.remote.misc.connectionId.ConnectionIdTest \
javasoft.sqe.tests.api.javax.management.remote.rmi.RMIConnectorServer.RMIConnectorServerAttachedMBSTest-TestCaseID AttachedMBSTest0009"

$JAVA -version
for i in $TEST
do
    echo "Executing test $i:"
    $JAVA $OPTS $i $TOPTS
    echo "---------=========*********===========-------------"
done

Please, see *.jtr files attached.

Comments
EVALUATION IllegalIIOPURLTest.java makes a Runtime.exec call to start orbd. But the connection failure exceptions all happen because the orbd is not yet responding. Thread.sleep(3000) after the Runtime.exec calls makes it always run reliably for me.
21-01-2009

EVALUATION Most of the affected tests are present in JCK 1.5a, but they passes without a single exception for jdk 1.5.0_17 b07 and for 1.5.0_16 b12.
13-01-2009

EVALUATION After backing out 6725987 and 6773533 from 6u12-b03 master ws, this issue is resolved.
20-12-2008

EVALUATION Here is the answer on the first Ken's question. The tests don't explicitly create an ORB for use in the RMIConnector. All tests mentioned in the bug report are similar. Here is a direct link to one of the test sources: http://javaweb.sfbay/java/re/jck/6b/archive/fcs/binaries/JCK-runtime-6b/tests/api/javax_management/remote/rmi/RMIConnectorServer
12-12-2008

EVALUATION I'm not sure that this is an ORB bug. What I see in the 6u10 traceback is clear evidence that an operation was performed on the ORB AFTER the ORB was shutdown. That is clearly illegal, and points to a possible error in either the test or the RMIConnector code. I recently worked with Kevin Walls to get a number of memory leak fixes into the JDK 6u12 ORB for bug 6725987. One result of these changes is that the exceptions thrown by code performing operations on a destroyed ORB may change (and note that this is unspecified behavior: there are no defined semantics for performing operations on a destroyed ORB instance). I'd like to find out a few things from people knowledgable about RMIConnector and the specific JCK tests: 1. Does the test explicitly create an ORB for use in the RMIConnector? If so, exactly how does the test destroy the ORB? For example, calling ORB.destroy in a finally block, then performing operations on the ORB after the finally block is illegal and will result in unspecified behavior. 2. Is there something in the RMIConnector code that could be causing the ORB.destroy call? I did not find it immediately, but I am not familiar with that code.
10-12-2008