liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException: Could not find directory or directory was empty for includeAll 'included/'

JIRA | Matt Bertolini | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    I encountered this by accident when I went to add a branch of Liquibase to my Jenkins CI server. A bunch of the unit tests fail when there are spaces in the absolute file path to change logs. The test that is failing is the {{XMLChangeLogSAXParser_RealFile_Test}} class. While I don't like spaces in file paths they are a technical possibility an therefore need to be supported. I have also re-created it on my Mac. I haven't had a chance to test it on my Windows machine but I figure it will happen there as well. Here is the stack trace on the Mac: {noformat} liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException: /Users/matt/dev/testing 123/liquibase/liquibase-core/target/test-classes/liquibase/parser/core/xml/included/included.changelog1.xml does not exist at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:27) at liquibase.parser.core.xml.XMLChangeLogSAXParser_RealFile_Test.changeSets with one level of includes parse correctly(XMLChangeLogSAXParser_RealFile_Test.groovy:205) Caused by: liquibase.exception.SetupException: /Users/matt/dev/testing 123/liquibase/liquibase-core/target/test-classes/liquibase/parser/core/xml/included/included.changelog1.xml does not exist at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:266) at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:221) at liquibase.changelog.DatabaseChangeLog.load(DatabaseChangeLog.java:193) at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:25) ... 1 more Caused by: liquibase.exception.ChangeLogParseException: /Users/matt/dev/testing 123/liquibase/liquibase-core/target/test-classes/liquibase/parser/core/xml/included/included.changelog1.xml does not exist at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:95) at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:17) at liquibase.changelog.DatabaseChangeLog.include(DatabaseChangeLog.java:288) at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:263) ... 4 more {noformat} I believe the issue to be that file paths with spaces are URL encoded in Java and need to be decoded before using them in a {{java.io.File}} class. I was working on attempting to fix this. I started tracking down the bug and made a change in the {{AbstractResourceAccessor}} class {{convertToPath(String, String)}} method. I wrapped the {{baseUrl.getPath()}} call with a {{URLDecoder.decode()}} method. {code:java} if (baseUrl.toExternalForm().startsWith("file:")) { File baseFile = new File(baseUrl.getPath()); // Wrap getPath() in URLDecoder.decode() if (!baseFile.exists()) { throw new UnexpectedLiquibaseException("Base file '"+baseFile.getAbsolutePath()+"' does not exist"); } if (baseFile.isFile()) { baseFile = baseFile.getParentFile(); } return convertToPath(baseFile.toURI().getPath()+"/"+path); } {code} I think that eliminated the first stack trace but the unit tests still fail with two different but similar stacktraces: {noformat} liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException: /Users/matt/dev/testing 123/liquibase/liquibase-core/target/test-classes/liquibase/parser/core/xml/included/included.changelog1.xml does not exist at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:27) at liquibase.parser.core.xml.XMLChangeLogSAXParser_RealFile_Test.changeSets with one level of includes parse correctly(XMLChangeLogSAXParser_RealFile_Test.groovy:205) Caused by: liquibase.exception.SetupException: /Users/matt/dev/testing 123/liquibase/liquibase-core/target/test-classes/liquibase/parser/core/xml/included/included.changelog1.xml does not exist at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:266) at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:221) at liquibase.changelog.DatabaseChangeLog.load(DatabaseChangeLog.java:193) at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:25) ... 1 more Caused by: liquibase.exception.ChangeLogParseException: /Users/matt/dev/testing 123/liquibase/liquibase-core/target/test-classes/liquibase/parser/core/xml/included/included.changelog1.xml does not exist at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:95) at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:17) at liquibase.changelog.DatabaseChangeLog.include(DatabaseChangeLog.java:288) at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:263) ... 4 more {noformat} and: {noformat} liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException: Could not find directory or directory was empty for includeAll 'included/' at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:27) at liquibase.parser.core.xml.XMLChangeLogSAXParser_RealFile_Test.changeSets with one level of includes parse correctly(XMLChangeLogSAXParser_RealFile_Test.groovy:205) Caused by: liquibase.exception.SetupException: Could not find directory or directory was empty for includeAll 'included/' at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:266) at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:221) at liquibase.changelog.DatabaseChangeLog.load(DatabaseChangeLog.java:193) at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:25) ... 1 more Caused by: liquibase.exception.SetupException: Could not find directory or directory was empty for includeAll 'included/' at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:259) ... 4 more {noformat} I'm still looking into it but I figured I would file the ticket with the hope that you might have more information as to a solution (or know how to fix it quicker than me :-) ).

    JIRA | 3 years ago | Matt Bertolini
    liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException: Could not find directory or directory was empty for includeAll 'included/'
  2. 0

    I encountered this by accident when I went to add a branch of Liquibase to my Jenkins CI server. A bunch of the unit tests fail when there are spaces in the absolute file path to change logs. The test that is failing is the {{XMLChangeLogSAXParser_RealFile_Test}} class. While I don't like spaces in file paths they are a technical possibility an therefore need to be supported. I have also re-created it on my Mac. I haven't had a chance to test it on my Windows machine but I figure it will happen there as well. Here is the stack trace on the Mac: {noformat} liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException: /Users/matt/dev/testing 123/liquibase/liquibase-core/target/test-classes/liquibase/parser/core/xml/included/included.changelog1.xml does not exist at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:27) at liquibase.parser.core.xml.XMLChangeLogSAXParser_RealFile_Test.changeSets with one level of includes parse correctly(XMLChangeLogSAXParser_RealFile_Test.groovy:205) Caused by: liquibase.exception.SetupException: /Users/matt/dev/testing 123/liquibase/liquibase-core/target/test-classes/liquibase/parser/core/xml/included/included.changelog1.xml does not exist at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:266) at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:221) at liquibase.changelog.DatabaseChangeLog.load(DatabaseChangeLog.java:193) at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:25) ... 1 more Caused by: liquibase.exception.ChangeLogParseException: /Users/matt/dev/testing 123/liquibase/liquibase-core/target/test-classes/liquibase/parser/core/xml/included/included.changelog1.xml does not exist at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:95) at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:17) at liquibase.changelog.DatabaseChangeLog.include(DatabaseChangeLog.java:288) at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:263) ... 4 more {noformat} I believe the issue to be that file paths with spaces are URL encoded in Java and need to be decoded before using them in a {{java.io.File}} class. I was working on attempting to fix this. I started tracking down the bug and made a change in the {{AbstractResourceAccessor}} class {{convertToPath(String, String)}} method. I wrapped the {{baseUrl.getPath()}} call with a {{URLDecoder.decode()}} method. {code:java} if (baseUrl.toExternalForm().startsWith("file:")) { File baseFile = new File(baseUrl.getPath()); // Wrap getPath() in URLDecoder.decode() if (!baseFile.exists()) { throw new UnexpectedLiquibaseException("Base file '"+baseFile.getAbsolutePath()+"' does not exist"); } if (baseFile.isFile()) { baseFile = baseFile.getParentFile(); } return convertToPath(baseFile.toURI().getPath()+"/"+path); } {code} I think that eliminated the first stack trace but the unit tests still fail with two different but similar stacktraces: {noformat} liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException: /Users/matt/dev/testing 123/liquibase/liquibase-core/target/test-classes/liquibase/parser/core/xml/included/included.changelog1.xml does not exist at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:27) at liquibase.parser.core.xml.XMLChangeLogSAXParser_RealFile_Test.changeSets with one level of includes parse correctly(XMLChangeLogSAXParser_RealFile_Test.groovy:205) Caused by: liquibase.exception.SetupException: /Users/matt/dev/testing 123/liquibase/liquibase-core/target/test-classes/liquibase/parser/core/xml/included/included.changelog1.xml does not exist at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:266) at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:221) at liquibase.changelog.DatabaseChangeLog.load(DatabaseChangeLog.java:193) at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:25) ... 1 more Caused by: liquibase.exception.ChangeLogParseException: /Users/matt/dev/testing 123/liquibase/liquibase-core/target/test-classes/liquibase/parser/core/xml/included/included.changelog1.xml does not exist at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:95) at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:17) at liquibase.changelog.DatabaseChangeLog.include(DatabaseChangeLog.java:288) at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:263) ... 4 more {noformat} and: {noformat} liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException: Could not find directory or directory was empty for includeAll 'included/' at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:27) at liquibase.parser.core.xml.XMLChangeLogSAXParser_RealFile_Test.changeSets with one level of includes parse correctly(XMLChangeLogSAXParser_RealFile_Test.groovy:205) Caused by: liquibase.exception.SetupException: Could not find directory or directory was empty for includeAll 'included/' at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:266) at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:221) at liquibase.changelog.DatabaseChangeLog.load(DatabaseChangeLog.java:193) at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:25) ... 1 more Caused by: liquibase.exception.SetupException: Could not find directory or directory was empty for includeAll 'included/' at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:259) ... 4 more {noformat} I'm still looking into it but I figured I would file the ticket with the hope that you might have more information as to a solution (or know how to fix it quicker than me :-) ).

    JIRA | 3 years ago | Matt Bertolini
    liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException: Could not find directory or directory was empty for includeAll 'included/'
  3. 0

    The documentation (http://www.liquibase.org/documentation/xml_format.html) says: {quote} Liquibase Extension XSDs If you use a Liquibase extension that includes additional change tags, check the extension documentation to find out if they provide a XSD. If they do not, you can use the xsd at http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd which allows any nested tag and attribute.{quote} Custom XSDs are very handy in order to use auto-complete in XML editors. However, when I actually try to use one for Oracle Extensions (https://raw.githubusercontent.com/liquibase/liquibase-oracle/master/src/main/java/liquibase/ext/ora/xml/dbchangelog-ext.xsd), Liquibase fails: DEBUG 4/14/16 10:49 AM: liquibase: Local path for https://raw.githubusercontent.com/liquibase/liquibase-oracle/master/src/main/java/liquibase/ext/ora/xml/dbchangelog-ext.xsd is null DEBUG 4/14/16 10:49 AM: liquibase: Attempting to load https://raw.githubusercontent.com/liquibase/liquibase-oracle/master/src/main/java/liquibase/ext/ora/xml/dbchangelog-ext.xsd from resourceAccessor as sql/Release-Migration/https:/raw.githubusercontent.com/liquibase/liquibase-oracle/master/src/main/java/liquibase/ext/ora/xml/dbchangelog-ext.xsd DEBUG 4/14/16 10:49 AM: liquibase: Could not load https://raw.githubusercontent.com/liquibase/liquibase-oracle/master/src/main/java/liquibase/ext/ora/xml/dbchangelog-ext.xsd from resourceAccessor as sql/Release-Migration/https:/raw.githubusercontent.com/liquibase/liquibase-oracle/master/src/main/java/liquibase/ext/ora/xml/dbchangelog-ext.xsd DEBUG 4/14/16 10:49 AM: liquibase: Unable to resolve XML entity locally. Will load from network. SEVERE 4/14/16 10:49 AM: liquibase: src-resolve: Cannot resolve the name 'MaterializedViewRefreshType' to a(n) 'type definition' component. DEBUG 4/14/16 10:49 AM: liquibase: Release Database Lock DEBUG 4/14/16 10:49 AM: liquibase: Executing UPDATE database command: UPDATE LINK_OD_IREPORT.DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1 INFO 4/14/16 10:49 AM: liquibase: Successfully released change log lock Unexpected error running Liquibase: src-resolve: Cannot resolve the name 'MaterializedViewRefreshType' to a(n) 'type definition' component. SEVERE 4/14/16 10:49 AM: liquibase: src-resolve: Cannot resolve the name 'MaterializedViewRefreshType' to a(n) 'type definition' component. liquibase.exception.ChangeLogParseException: Error parsing line 205 column 100 of sql/Release-Migration/Release-Delta.xml: src-resolve: Cannot resolve the name 'MaterializedViewRefreshType' to a(n) 'type definition' component. at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:114) at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:17) at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:227)}} I'm attaching the extracted test case.

    JIRA | 11 months ago | Dmitriy Korobskiy
    liquibase.exception.ChangeLogParseException: Error parsing line 205 column 100 of sql/Release-Migration/Release-Delta.xml: src-resolve: Cannot resolve the name 'MaterializedViewRefreshType' to a(n) 'type definition' component.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    liquibase NPE 'Name is null' with Grails 3.0.17 and v2.0.0

    GitHub | 4 months ago | j4y
    liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException: java.lang.NullPointerException: Name is null

    Root Cause Analysis

    1. liquibase.exception.ChangeLogParseException

      liquibase.exception.SetupException: Could not find directory or directory was empty for includeAll 'included/'

      at liquibase.parser.core.xml.AbstractChangeLogParser.parse()
    2. Liquibase Core
      AbstractChangeLogParser.parse
      1. liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:27)
      1 frame