Derby
  1. Derby
  2. DERBY-5677

ClassNotFoundException when running suites.All without derbynet.jar

    Details

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

      Description

      There is some logic in the test harness to allow test runs without derbynet.jar on the classpath (to test the embedded engine only). When I tried this on head of trunk, it failed with java.lang.ClassNotFoundException: org.apache.derby.drda.NetworkServerControl when setting up the test suites, so no tests started.

      1. d5677-1a-exclude.diff
        7 kB
        Knut Anders Hatlen

        Activity

        Hide
        Knut Anders Hatlen added a comment -

        Attached is a patch that makes suites.All pass both with and without derbynet.jar in my environment. It makes the following changes:

        • derbynet/DerbyNetNewServer.java:

        The test cases in this class require the network server, so I made the suite() method return an empty suite if the server isn't available.

        • derbynet/NSSecurityMechanismTest.java:

        This class couldn't be loaded by derbynet._Suite because of some local variables of type NetworkServerControl (which is a class in derbynet.jar). Not sure exactly why this caused a problem, as other test classes have local variables of that type and can still be loaded. In any case, the class loaded just fine when I changed it to use some helper methods in NetworkServerTestSetup to access NetworkServerControl.

        • engine/RestrictiveFilePermissionsTest.java:

        One of the test cases starts an external network server. I made suite() skip that test case when the server classes are not available.

        • replicationTests/ReplicationSuite.java:

        The ReplicationRun class uses NetworkServerControl in some of its method signatures and cannot be loaded if derbynet.jar isn't on the classpath. I made ReplicationSuite return an empty suite if there is no network server, so that it doesn't try to load the ReplicationRun class.

        Show
        Knut Anders Hatlen added a comment - Attached is a patch that makes suites.All pass both with and without derbynet.jar in my environment. It makes the following changes: derbynet/DerbyNetNewServer.java: The test cases in this class require the network server, so I made the suite() method return an empty suite if the server isn't available. derbynet/NSSecurityMechanismTest.java: This class couldn't be loaded by derbynet._Suite because of some local variables of type NetworkServerControl (which is a class in derbynet.jar). Not sure exactly why this caused a problem, as other test classes have local variables of that type and can still be loaded. In any case, the class loaded just fine when I changed it to use some helper methods in NetworkServerTestSetup to access NetworkServerControl. engine/RestrictiveFilePermissionsTest.java: One of the test cases starts an external network server. I made suite() skip that test case when the server classes are not available. replicationTests/ReplicationSuite.java: The ReplicationRun class uses NetworkServerControl in some of its method signatures and cannot be loaded if derbynet.jar isn't on the classpath. I made ReplicationSuite return an empty suite if there is no network server, so that it doesn't try to load the ReplicationRun class.
        Hide
        Knut Anders Hatlen added a comment -

        Committed revision 1308434.

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

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development