Derby
  1. Derby
  2. DERBY-5917

NoClassDefFoundErrors when running tests without derbynet.jar and derbyclient.jar

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.10.1.1
    • Fix Version/s: 10.10.1.1
    • Component/s: Test
    • Labels:
      None

      Description

      The following errors are seen when running tests without derbynet.jar and derbyclient.jar in the classpath:

      • The suite() method in jdbcapi.ClientConnectionPoolDataSourceTest fails with a NoClassDefFoundError (for org/apache/derby/jdbc/ClientConnectionPoolDataSource)
      • The test_jdbc4_1() test cases in jdbc4.CallableStatementTest, jdbc4.DataSourceTest, jdbc4.ConnectionMethodsTest and jdbc4.AbortTest fail with NoClassDefFoundErrors (for org/apache/derby/client/net/NetResultSet40, org/apache/derby/jdbc/ClientDataSource40 and org/apache/derby/client/net/NetConnection40)
      1. d5917-2a.diff
        9 kB
        Knut Anders Hatlen
      2. d5917-1a.diff
        10 kB
        Knut Anders Hatlen

        Activity

        Hide
        Knut Anders Hatlen added a comment -

        The patch d5917-1a.diff makes the following changes:

        • TestConfiguration: Shortcut helper methods for client/server tests earlier if the client or server is missing, to prevent attempts to load client classes when building intermediate test suites that are eventually discarded.
        • Wrapper41, Wrapper41Conn, Wrapper41DataSource: Reorder the instanceof checks in the constructors so that the checks for embedded classes come first. Then we won't check for client classes if only the embedded tests run.

        This changes makes the previously failing tests pass when run without client and server jars. I've also successfully run the full regression suite (with client/server jars).

        Show
        Knut Anders Hatlen added a comment - The patch d5917-1a.diff makes the following changes: TestConfiguration: Shortcut helper methods for client/server tests earlier if the client or server is missing, to prevent attempts to load client classes when building intermediate test suites that are eventually discarded. Wrapper41, Wrapper41Conn, Wrapper41DataSource: Reorder the instanceof checks in the constructors so that the checks for embedded classes come first. Then we won't check for client classes if only the embedded tests run. This changes makes the previously failing tests pass when run without client and server jars. I've also successfully run the full regression suite (with client/server jars).
        Hide
        Knut Anders Hatlen added a comment -

        Committed revision 1382032.

        Show
        Knut Anders Hatlen added a comment - Committed revision 1382032.
        Hide
        Knut Anders Hatlen added a comment -

        There are still two tests failing when running without client and server jars. Didn't notice them in the first attempt, since the failure in the suite() method prevented the jdbcapi from running. XATransactionTest fails because it uses the ClientXid class directly, also when running embedded tests. CacheSessionDataTest fails because it checks if the connection is a client.am.Connection instance in order to find out if it's running with the client.

        Show
        Knut Anders Hatlen added a comment - There are still two tests failing when running without client and server jars. Didn't notice them in the first attempt, since the failure in the suite() method prevented the jdbcapi from running. XATransactionTest fails because it uses the ClientXid class directly, also when running embedded tests. CacheSessionDataTest fails because it checks if the connection is a client.am.Connection instance in order to find out if it's running with the client.
        Hide
        Knut Anders Hatlen added a comment -

        Attaching d5917-2a which fixes the remaining issues:

        XATransactionTest: Use XATestUtil to create Xid instead of using ClientXid (also needed to add hashCode() and equals() methods to the utilXid class used by XATestUtil so that it could be used in assertEquals().)

        CacheSessionDataTest: Test for usingDerbyNetClient() instead of instanceof client.am.Connection

        Compatibility tests: disable if derbyclient.jar or derbynet.jar is missing.

        derbyrunjartest: Don't test the server command if the server is not available.

        All the regression tests ran cleanly with the patch (tested both with and without server/client jars in classpath).

        Show
        Knut Anders Hatlen added a comment - Attaching d5917-2a which fixes the remaining issues: XATransactionTest: Use XATestUtil to create Xid instead of using ClientXid (also needed to add hashCode() and equals() methods to the utilXid class used by XATestUtil so that it could be used in assertEquals().) CacheSessionDataTest: Test for usingDerbyNetClient() instead of instanceof client.am.Connection Compatibility tests: disable if derbyclient.jar or derbynet.jar is missing. derbyrunjartest: Don't test the server command if the server is not available. All the regression tests ran cleanly with the patch (tested both with and without server/client jars in classpath).
        Hide
        Knut Anders Hatlen added a comment -

        Committed revision 1382791.

        Show
        Knut Anders Hatlen added a comment - Committed revision 1382791.

          People

          • Assignee:
            Knut Anders Hatlen
            Reporter:
            Knut Anders Hatlen
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development