3 Replies Latest reply on May 21, 2010 10:39 AM by Michael Musgrove

    How do you run JTS unit tests in a debugger

    Michael Musgrove Master

      I get the following error when running the JTS unit tests in a debugger (Intellij). Basically, any test that tries to load org.jacorb.orb.ORB gets a class not found exception followed by the indicated class not found exception. The tests run fine if the debugger isn't attached.

       

       

        • 1. Re: How do you run JTS unit tests in a debugger
          Michael Musgrove Master

          And the missing error is:

          Testsuite: com.hp.mwtests.ts.jta.jts.jca.TransactionImpleUnitTest
          Tests run: 1, Failures: 0, Errors: 2, Time elapsed: 584.476 sec
          ------------- Standard Output ---------------
          2010-05-21 15:02:33,772 [main] FATAL com.arjuna.orbportability - [com.arjuna.orbportability.orb.core.ORB.unsupportedorb] ORB specific class creation failed - unable to find supported ORB
          java.lang.ClassNotFoundException: com.sun.corba.se.internal.corba.ORB
              at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
              at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
              at com.arjuna.orbportability.orb.core.ORB.initialise(ORB.java:127)
              at com.arjuna.orbportability.orb.core.ORB.<init>(ORB.java:58)
              at com.arjuna.orbportability.ORB.<init>(ORB.java:438)
              at com.arjuna.orbportability.ORB.getInstance(ORB.java:425)
              at com.hp.mwtests.ts.jta.jts.common.TestBase.setUp(TestBase.java:50)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
              at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
              at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
              at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
              at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
              at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
              at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
              at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
              at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
              at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
              at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
              at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
              at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
              at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
              at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:421)
              at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:912)
              at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:766)
          ------------- ---------------- ---------------

          • 2. Re: How do you run JTS unit tests in a debugger
            Andrew Dinn Master

            Hmm, very strange. The ClassNotFoundException in the trace is thrown from line 127 of Orb.java

             

            private final void initialise ()
                {
                /*
                 * Let the application provide its own ORB implementation.
                 */

                String className = opPropertyManager.getOrbPortabilityEnvironmentBean().getOrbImplementation();

                    if (className == null)
                    {
                        try
                        {
                            Thread.currentThread().getContextClassLoader().loadClass("org.jacorb.orb.ORB");

                            className = "com.arjuna.orbportability.internal.orbspecific.jacorb.orb.implementations.jacorb_2_0";
                        }
                        catch (ClassNotFoundException ce)
                        {
                            //            ce.printStackTrace();

                            try
                            {

            line 127 >>>
                                Thread.currentThread().getContextClassLoader().loadClass("com.sun.corba.se.internal.corba.ORB");

            line 127 <<<

                                className = "com.arjuna.orbportability.internal.orbspecific.javaidl.orb.implementations.javaidl_1_4";
                            }
                            catch (ClassNotFoundException je)
                            {
                                //                je.printStackTrace();

                                if (opLogger.loggerI18N.isFatalEnabled())
                                {
                                    opLogger.loggerI18N.fatal( "com.arjuna.orbportability.orb.core.ORB.unsupportedorb", je );
                                }

                                throw new ExceptionInInitializerError(opLogger.loggerI18N.getString("com.arjuna.orbportability.orb.core.ORB.unsupportedorb"));
                            }
                        }
                    }

             

            The load ought to find the jacorb implementation. So, it looks like attaching the debugger has caused the call to loadClass("org.jacorb.orb.Orb") to fail. That's very weird. It might be that there is a race condition in the classloaders which this has uncovered e,g, by changing timings. I can't see how else it could happen. The debugger is not supposed to modify any of the load  paths. You could try uncommenting the printStacktrace call to see why the first load is failing. That might provide some info. Alternatively, you could break at the first loadclass and step through the load code.

            • 3. Re: How do you run JTS unit tests in a debugger
              Michael Musgrove Master

              User error.

               

              I was attaching to the debugger by passing additional jvmargs to the run.tests.macro in the ant build file but I omitted including jacorb.jar on the classpath.