| 
 Relates :   
 | 
|
| 
 Relates :   
 | 
|
| 
 Relates :   
 | 
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.
  |