Derby
  1. Derby
  2. DERBY-4944

Embedded Derby does not start when derby.jar is dynamically uploaded / added to the classpath

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.6.2.1
    • Fix Version/s: 10.7.1.4, 10.8.1.2
    • Component/s: Store
    • Labels:
      None
    • Environment:
      various windows versions, jdk1.6.0 and 1.5.0
    • Issue & fix info:
      Workaround attached
    • Bug behavior facts:
      Regression, Seen in production

      Description

      Hi,

      For our workflow-system, we can use a variety of DBMS as the store engine. Derby is one of them especially popular
      for test and development purposes. During setup of our system, we allow to upload a jar file with the JDBC-Driver for the DBMS.
      In case of derby, we use the embedded mode and upload derby.jar. After that we add the jar to the repositories of our class loader
      and call

      Class drc = Class.forName("org.apache.derby.jdbc.EmbeddedDriver", true, ourclassloader);
      Driver drv = (Driver)drc.newInstance();

      this worked perfectly for many years up to version 10.6.1.0, but ceased to work in 10.6.2.1;
      i assume the unreleased future versions are affected, too

      when derby.jar is placed in the classpath manually before starting our setup, everything works fine regardless of the derby version.

      investigations lead to the following conclusion:

      • since rev. 982370 this is broken, in the immediate predecessor rev. 980035 it worked.
      • rev. 982370 in the org.apache.derby.impl.store.raw.data.BaseDataFileFactory class introduced a new method
        private static String jarClassPath(final Class cls) which tries to find the jarfile from which derby was loaded.

      it contains the following lines:

      if ( cs == null )
      return null;
      URL result = cs.getLocation();
      return result.toString();

      but in the case, when we dynamically load derby,
      cs is not null but cs.getLocation() is null. so i propose to change the line with the if to:
      ...
      if ( cs == null || cs.getLocation()==null)
      return null;
      ...

      or maybe it would be better to surround the whole body of the method with a try catch, since it is not essential, and a null
      return value is also ok?

      thank you for your efforts concerning derby at large,

      Michael

      1. BDFF.diff
        0.6 kB
        Michael Dobrovnik

        Issue Links

          Activity

          Michael Dobrovnik created issue -
          Michael Dobrovnik made changes -
          Field Original Value New Value
          Attachment BDFF.diff [ 12466220 ]
          Michael Dobrovnik made changes -
          Affects Version/s 10.6.2.1 [ 12315343 ]
          Affects Version/s 11.0.0.0 [ 12312083 ]
          Dag H. Wanvik made changes -
          Assignee Dag H. Wanvik [ dagw ]
          Kathey Marsden made changes -
          Link This issue is related to DERBY-4715 [ DERBY-4715 ]
          Kathey Marsden made changes -
          Bug behavior facts [Seen in production] [Regression, Seen in production]
          Dag H. Wanvik made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Issue & fix info [Workaround attached, Patch Available] [Workaround attached]
          Fix Version/s 10.8.0.0 [ 12315561 ]
          Resolution Fixed [ 1 ]
          Knut Anders Hatlen made changes -
          Link This issue is duplicated by DERBY-5178 [ DERBY-5178 ]
          Rick Hillegas made changes -
          Fix Version/s 10.8.1.1 [ 12316356 ]
          Fix Version/s 10.8.1.0 [ 12315561 ]
          Rick Hillegas made changes -
          Fix Version/s 10.8.1.2 [ 12316362 ]
          Fix Version/s 10.8.1.1 [ 12316356 ]
          Knut Anders Hatlen made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Gavin made changes -
          Workflow jira [ 12540096 ] Default workflow, editable Closed status [ 12802886 ]
          Myrna van Lunteren made changes -
          Resolution Fixed [ 1 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          Assignee Dag H. Wanvik [ dagw ] Myrna van Lunteren [ myrna ]
          Myrna van Lunteren made changes -
          Status Reopened [ 4 ] Closed [ 6 ]
          Assignee Myrna van Lunteren [ myrna ] Dag H. Wanvik [ dagw ]
          Fix Version/s 10.7.1.4 [ 12315902 ]
          Resolution Fixed [ 1 ]

            People

            • Assignee:
              Dag H. Wanvik
              Reporter:
              Michael Dobrovnik
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development