Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-14629

Liquibase update fails when using changelog from jar

    XMLWordPrintable

Details

    Description

      Environment (Required on creation):

      Spring boot with version 7.17.

      Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket):

      Liquibase cannot resolve the files with relative paths to the parent directory, e.g. path="../upgrade/${db.name}_engine_7.16_to_7.17.sql". It doesn't have any problems with other relatives paths.
      The error only happens when referencing the changelog within the engine jar file.

      The following exception is thrown:

      2022-05-04 13:22:50,864 [WARN ] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.LiquibaseException: liquibase.exception.UnexpectedLiquibaseException: java.io.IOException: The file ../upgrade/h2_engine_7.16_to_7.17.sql was not found in
          - Spring resources
      Specifying files by absolute path was removed in Liquibase 4.0. Please use a relative path or add '/' to the classpath parameter. [org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext] [main] [org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:591)] [{}]
      
      

      Steps to reproduce (Required on creation):

      Create a spring boot project, add the liquibase maven dependency and configure it to use the liquibase changelog from the engine jar:

      camunda.bpm.database.schema-update=false
      spring.liquibase.enabled=true
      spring.liquibase.change-log=classpath:org/camunda/bpm/engine/db/liquibase/camunda-changelog.xml
      

      or create your own custom changelog under resources and include the camunda changelog:

      camunda.bpm.database.schema-update=false
      spring.liquibase.enabled=true
      spring.liquibase.change-log=db/custom-changelog.xml
      
      <include file="classpath:/org/camunda/bpm/engine/db/liquibase/camunda-changelog.xml" />
      

      Observed Behavior (Required on creation):

      Liquibase update fails.

      Expected behavior (Required on creation):

      Liquibase update should successfully complete.

      Root Cause (Required on prioritization):

      The root cause seems to be in liquibase and the way it handles this use-case.
      https://github.com/liquibase/liquibase/issues/1277 - already closed but people are mentioning very similar issues with jar files.

      Solution Ideas (Optional):

      • Avoid the parent navigation in the relative paths, e.g. by placing the liquibase-changelog.xml file into the parent directory

      Hints (optional):

      mgm-controller-panel

        This is the controller panel for Smart Panels app

        Attachments

          Activity

            People

              Unassigned Unassigned
              daniel.kelemen Daniel Kelemen
              Tobias Metzke-Bernstein Tobias Metzke-Bernstein
              Daniel Kelemen Daniel Kelemen
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Salesforce