Uploaded image for project: 'Liquibase Core'
  1. CORE-829

Embedded Derby shutdown does not work with Maven

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 3.0.0
    • Component/s: None

      Description

      DerbyDatabase's close() method smartly attempts to reconnect to Derby database with ;shutdown=true to shut it down.

      However, under Maven, the driver is generally provided as a dependency and therefore only shows up in the artifact classloader (MavenUtils.getArtifactClassloader). This causes: java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver and the .lck files are kept around (making it inaccessible to anyone else).

      On shutdown, Derby throws a SQLException with SQL state XJ015. To handle this, Liquibase catches Exception and silently swallows it.

      I'm not quite sure the best way to get a fresh connection to Derby to ask it to shutdown, but I do recommend splitting the catches up such that the XJ015 is okay, but other exceptions are not:

       } catch (SQLException se)  {
            if ( !se.getSQLState().equals("XJ015") ) {
               throw new DatabaseException(...,se);
            }
         } catch (Exception e) { 
            throw new DatabaseException(...,e);
         }
      

        Attachments

          Activity

            People

            • Reporter:
              idcmp idcmp (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: