Derby
  1. Derby
  2. DERBY-4781

suites.All fails completely with Failed to invoke suite():java.lang.reflect.InvocationTargetException because of XplainStatisticsTest

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.7.1.1
    • Fix Version/s: 10.7.1.1
    • Component/s: Test
    • Labels:
      None
    • Environment:
      java.fullversion: IBM J9 2.4 Windows XP x86-32 (JIT enabled, AOT enabled)
      J9VM - 20080919_023055_lHdFGQ
      JIT - r9.weme62_20080724_2131
      GC - 20080609_AA
    • Issue & fix info:
      High Value Fix
    • Bug behavior facts:
      Regression Test Failure

      Description

      weme 6.2 tests fail to kick off because of XplainStatisticsTest after the change:
      r982637 DERBY-4587: Add tools for query plan analysis

      The problem seems related to the import and use of

      import org.w3c.dom.Document;
      import org.w3c.dom.NodeList;

      I am not sure if there are additional jars that I need to use to get these libraries from the weme distribution or if they are available. After this same checkin the test also fails on CVM/phoneme with the error below but it does not prevent the full suite from kicking off.

      ime: 15,558.801
      There was 1 error:
      1) testScanPositions(org.apache.derbyTesting.functionTests.tests.lang.XplainStatisticsTest)java.lang.NoSuchMethodError: java.lang.String: method split(Ljava/lang/String[Ljava/lang/String; not found
      at org.apache.derby.impl.tools.planexporter.AccessDatabase.replace(Unknown Source)
      at org.apache.derby.impl.tools.planexporter.AccessDatabase.statement(Unknown Source)
      at org.apache.derbyTesting.functionTests.tests.lang.XplainStatisticsTest.disableXplainStyle(Unknown Source)
      at org.apache.derbyTesting.functionTests.tests.lang.XplainStatisticsTest.testScanPositions(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestCase.runBare(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at sun.misc.CVM.runMain(Unknown Source)

      FAILURES!!!

      http://dbtg.foundry.sun.com/derby/test/Daily/javaME/testing/testlog/ubuntu/983036-suitesAll_diff.txt

      1. signature.diff
        2 kB
        Knut Anders Hatlen
      2. ReplaceTest.java
        0.8 kB
        Knut Anders Hatlen
      3. derby-4587-removeSplitMethod.diff
        0.7 kB
        Nirmal Fernando
      4. derby-4587-removeSplitMethod.diff
        1.0 kB
        Nirmal Fernando
      5. derby-4587-removeSplitMethod.diff
        0.8 kB
        Nirmal Fernando
      6. derby-4587-removeSplitMethod.diff
        0.9 kB
        Nirmal Fernando
      7. derby-4587-fixerToDOM.diff
        3 kB
        Nirmal Fernando
      There are no Sub-Tasks for this issue.

        Activity

        Hide
        Knut Anders Hatlen added a comment -

        [bulk update] Close all resolved issues that haven't been updated for more than one year.

        Show
        Knut Anders Hatlen added a comment - [bulk update] Close all resolved issues that haven't been updated for more than one year.
        Hide
        Knut Anders Hatlen added a comment -

        Looks like the work is done on this issue. Marking as fixed.

        Show
        Knut Anders Hatlen added a comment - Looks like the work is done on this issue. Marking as fixed.
        Hide
        Knut Anders Hatlen added a comment -

        Thanks for the fix, Nirmal! I've committed it to trunk with revision 989036.

        Show
        Knut Anders Hatlen added a comment - Thanks for the fix, Nirmal! I've committed it to trunk with revision 989036.
        Hide
        Nirmal Fernando added a comment -

        Hi Knut, thanks for pointing that out! You're correct that method is broken.

        Thanks Bryan, for proposing that, I've overwritten the patch, with your suggestion.

        Sorry for the inconvenience!

        Show
        Nirmal Fernando added a comment - Hi Knut, thanks for pointing that out! You're correct that method is broken. Thanks Bryan, for proposing that, I've overwritten the patch, with your suggestion. Sorry for the inconvenience!
        Hide
        Bryan Pendleton added a comment -

        Rather than writing the method recursively, perhaps it's clearer to write it as a 'while' loop:

        int idx = stmt.indexOf(expr);
        while (idx >= 0)

        { stmt = stmt.substring(0, idx) + replace + stmt.substring(idx+1); idx = stmt.indexOf(expr); }

        return stmt;

        Show
        Bryan Pendleton added a comment - Rather than writing the method recursively, perhaps it's clearer to write it as a 'while' loop: int idx = stmt.indexOf(expr); while (idx >= 0) { stmt = stmt.substring(0, idx) + replace + stmt.substring(idx+1); idx = stmt.indexOf(expr); } return stmt;
        Hide
        Knut Anders Hatlen added a comment -

        The replace() method doesn't work as expected in my environment, at least. See the attached program ReplaceTest, which produces this output:

        replace("<hello>", "<", "<"): ""
        replace("adfad<adfadf", "<", "<"): ""
        replace("afad>asdfad", "<", "<"): "afad>asdfad"
        replace("test", "<", "<"): "test"

        Note that the first two calls return an empty string.

        Show
        Knut Anders Hatlen added a comment - The replace() method doesn't work as expected in my environment, at least. See the attached program ReplaceTest, which produces this output: replace("<hello>", "<", "<"): "" replace("adfad<adfadf", "<", "<"): "" replace("afad>asdfad", "<", "<"): "afad>asdfad" replace("test", "<", "<"): "test" Note that the first two calls return an empty string.
        Hide
        Nirmal Fernando added a comment -

        Hi Knut,

        I think the replace() method works fine! Since there's a recursive call to the same method just before the "return " ";" statement, therefore the return statement will be executed only when there's no matching character found.

        I've introduced a local variable for the stmt.indexOf(expr), and overwrite the patch.

        Thanks.

        Show
        Nirmal Fernando added a comment - Hi Knut, I think the replace() method works fine! Since there's a recursive call to the same method just before the "return " ";" statement, therefore the return statement will be executed only when there's no matching character found. I've introduced a local variable for the stmt.indexOf(expr), and overwrite the patch. Thanks.
        Hide
        Knut Anders Hatlen added a comment -

        The new replace() method looks broken to me. Won't it always return an empty string if a matching character is found? Also, does it need to call stmt.indexOf(expr) three times? Once ought to be enough, I think.

        Show
        Knut Anders Hatlen added a comment - The new replace() method looks broken to me. Won't it always return an empty string if a matching character is found? Also, does it need to call stmt.indexOf(expr) three times? Once ought to be enough, I think.
        Hide
        Kathey Marsden added a comment -

        Thank you Knut. signature.diff indeed made the tests run. I committed with revision 988321, so we should see weme run tonight.

        One thing I noticed is that there is a fairly large block of work in an if(XML.classpathMeetsXMLReqs()) block, so actually the same number of fixtures run with or without XML availability. It would be nice if somehow this testing could be a separate fixture so that we see a lower test count when fewer tests are run.

        Show
        Kathey Marsden added a comment - Thank you Knut. signature.diff indeed made the tests run. I committed with revision 988321, so we should see weme run tonight. One thing I noticed is that there is a fairly large block of work in an if(XML.classpathMeetsXMLReqs()) block, so actually the same number of fixtures run with or without XML availability. It would be nice if somehow this testing could be a separate fixture so that we see a lower test count when fewer tests are run.
        Hide
        Knut Anders Hatlen added a comment -

        Kathey, before we give up, could you check if the attached patch (signature.diff) solves the NoClassDefFoundError? I think we've seen before that weme complains if a class references an unknown class in one of the method signatures, but has no problems loading the class if the unknown class is only referenced inside the methods. The patch makes the getADocument() return an Object instead of a Document and lets the callers take care of casting the returned value to Document.

        Show
        Knut Anders Hatlen added a comment - Kathey, before we give up, could you check if the attached patch (signature.diff) solves the NoClassDefFoundError? I think we've seen before that weme complains if a class references an unknown class in one of the method signatures, but has no problems loading the class if the unknown class is only referenced inside the methods. The patch makes the getADocument() return an Object instead of a Document and lets the callers take care of casting the returned value to Document.
        Hide
        Nirmal Fernando added a comment -

        Hi Kathey,

        This should definitely solves the problem with the split method.

        Thanks.

        Show
        Nirmal Fernando added a comment - Hi Kathey, This should definitely solves the problem with the split method. Thanks.
        Hide
        Nirmal Fernando added a comment -

        Hi Kathey,

        I was searching for that API, thanks for the link! I'll attach a patch soon!

        Thanks for addressing the issue with weme too!

        Show
        Nirmal Fernando added a comment - Hi Kathey, I was searching for that API, thanks for the link! I'll attach a patch soon! Thanks for addressing the issue with weme too!
        Hide
        Bryan Pendleton added a comment -

        +1 to the solution Kathey proposes in DERBY-4782

        Show
        Bryan Pendleton added a comment - +1 to the solution Kathey proposes in DERBY-4782
        Hide
        Kathey Marsden added a comment -

        Hello Nirmal,

        for the removeSplitMethod patch, there is still and issue because replaceAll is not available either. See:
        http://download-llnw.oracle.com/javame/config/cldc/ref-impl/cldc1.1/jsr139/java/lang/String.html

        For the fixerToDOM patch it does not work to inline the full class names into the method. You would need to use Class.forName() to load the class and then reflection to get at the methods if the class does not exist. I think it would be ok though to just require that weme runs run with xml-apis.jar. I think it is fine to check it in and think it would be covered by the Xalan statement in the NOTICE file. We used to have it but removed it because it was no longer used by the build.

        Show
        Kathey Marsden added a comment - Hello Nirmal, for the removeSplitMethod patch, there is still and issue because replaceAll is not available either. See: http://download-llnw.oracle.com/javame/config/cldc/ref-impl/cldc1.1/jsr139/java/lang/String.html For the fixerToDOM patch it does not work to inline the full class names into the method. You would need to use Class.forName() to load the class and then reflection to get at the methods if the class does not exist. I think it would be ok though to just require that weme runs run with xml-apis.jar. I think it is fine to check it in and think it would be covered by the Xalan statement in the NOTICE file. We used to have it but removed it because it was no longer used by the build.
        Hide
        Nirmal Fernando added a comment -

        Hi Kathey,

        I think the problem occurred with weme is due to that two import lines, ideally I should not use them there. (PS: The tests already checks for the presence of these classes in the classpath. It's just that bad use of import made the noise I believe.)

        Hopefully this patch will solve the problem. Kathey, if you don't mind please run the test class after removing xml-apis.jar from your classpath and update me whether this works.

        Thank you very much!

        Show
        Nirmal Fernando added a comment - Hi Kathey, I think the problem occurred with weme is due to that two import lines, ideally I should not use them there. (PS: The tests already checks for the presence of these classes in the classpath. It's just that bad use of import made the noise I believe.) Hopefully this patch will solve the problem. Kathey, if you don't mind please run the test class after removing xml-apis.jar from your classpath and update me whether this works. Thank you very much!
        Hide
        Kathey Marsden added a comment -

        Thank you Nirmal. I do not actually see xml-apis.jar in the repository
        http://svn.apache.org/viewvc/db/derby/code/trunk/tools/java/

        I downloaded it with xalan 2.7.1, put it in my boot path and just get the split error seen with phoneme, so presumably xml-apis.jar is J2ME ready and works fine at least for this test. So I guess the question is should xml-apis.jar be checked in? It certainly would be convenient for weme runs if it is.

        Show
        Kathey Marsden added a comment - Thank you Nirmal. I do not actually see xml-apis.jar in the repository http://svn.apache.org/viewvc/db/derby/code/trunk/tools/java/ I downloaded it with xalan 2.7.1, put it in my boot path and just get the split error seen with phoneme, so presumably xml-apis.jar is J2ME ready and works fine at least for this test. So I guess the question is should xml-apis.jar be checked in? It certainly would be convenient for weme runs if it is.
        Hide
        Nirmal Fernando added a comment -

        Hi Kathey,

        These two classes are available in "xml-apis.jar" located in tools/java.

        Hope this helps!

        Thanks

        Show
        Nirmal Fernando added a comment - Hi Kathey, These two classes are available in "xml-apis.jar" located in tools/java. Hope this helps! Thanks
        Hide
        Kathey Marsden added a comment -

        I think that will resolve the failure with phoneme but weme is more serious. In weme we do not have the xml classes:

        import org.w3c.dom.Document;
        import org.w3c.dom.NodeList;

        And this leads to an immediate and complete failure of suites.All with suite():java.lang.reflect.InvocationTargetException.

        Running the test stand alone gives more information:
        + c:/cygwin/ibmsvn/ntsoftware/weme6.2/bin/j9 -jcl:foun11 -Demma.active= -Xbootclasspath
        a:c:/cygwin/ibmsvn/ntsoftware/weme6.2/lib/jdbc.jar -Dbootcp=c:/cygwin/ibmsvn/nt
        oftware/weme6.2/lib/jdbc.jar junit.textui.TestRunner org.apache.derbyTesting.fu
        ctionTests.tests.lang.XplainStatisticsTest
        Failed to invoke suite():java.lang.NoClassDefFoundError: org.w3c.dom.Document

        I searched all the jars and zips in the weme distribution for this class and did not see it. Myrna is checking if there is an external jar somewhere available. If not we will need to do something in the test to load the classes dynamically if available and skip the fixture using them for weme. Hopefully that won't be necessary.

        Show
        Kathey Marsden added a comment - I think that will resolve the failure with phoneme but weme is more serious. In weme we do not have the xml classes: import org.w3c.dom.Document; import org.w3c.dom.NodeList; And this leads to an immediate and complete failure of suites.All with suite():java.lang.reflect.InvocationTargetException. Running the test stand alone gives more information: + c:/cygwin/ibmsvn/ntsoftware/weme6.2/bin/j9 -jcl:foun11 -Demma.active= -Xbootclasspath a:c:/cygwin/ibmsvn/ntsoftware/weme6.2/lib/jdbc.jar -Dbootcp=c:/cygwin/ibmsvn/nt oftware/weme6.2/lib/jdbc.jar junit.textui.TestRunner org.apache.derbyTesting.fu ctionTests.tests.lang.XplainStatisticsTest Failed to invoke suite():java.lang.NoClassDefFoundError: org.w3c.dom.Document I searched all the jars and zips in the weme distribution for this class and did not see it. Myrna is checking if there is an external jar somewhere available. If not we will need to do something in the test to load the classes dynamically if available and skip the fixture using them for weme. Hopefully that won't be necessary.
        Hide
        Nirmal Fernando added a comment -

        Hi Kathey,

        This patch removes String.split() method and uses String.replaceAll() method.
        I'm not sure whether that method is available, though.

        Thanks.

        Show
        Nirmal Fernando added a comment - Hi Kathey, This patch removes String.split() method and uses String.replaceAll() method. I'm not sure whether that method is available, though. Thanks.
        Hide
        Bryan Pendleton added a comment -

        The exception seems to point to a problem with String.split() I agree. Nirmal, if you
        can construct a patch which does not use String.split(), then perhaps Kathey could
        check your patch in her environment to see if it resolves the problem for her?

        Show
        Bryan Pendleton added a comment - The exception seems to point to a problem with String.split() I agree. Nirmal, if you can construct a patch which does not use String.split(), then perhaps Kathey could check your patch in her environment to see if it resolves the problem for her?
        Hide
        Nirmal Fernando added a comment -

        Hi Kathey,

        To me it seems like this error was caused by the use of String.split() method, in the replace method of AccessDatabase class.
        May be replacement to that method would do? What you think?

        Thanks for pointing this out!!

        Show
        Nirmal Fernando added a comment - Hi Kathey, To me it seems like this error was caused by the use of String.split() method, in the replace method of AccessDatabase class. May be replacement to that method would do? What you think? Thanks for pointing this out!!

          People

          • Assignee:
            Nirmal Fernando
            Reporter:
            Kathey Marsden
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development