LiquiBase problem , class path resource db/changelog/db.changelog-master.yaml cannot be resolved to URL because it does not exist
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
The error "class path resource db/changelog/db.changelog-master.yaml cannot be resolved to URL because it does not exist" means Spring Boot cannot find your Liquibase changelog file at the expected classpath location. This typically happens because the file is in the wrong directory, has a wrong file extension, or the spring.liquibase.change-log property points to a non-existent path. The fix is to ensure the file exists at the exact path that Liquibase is configured to look for.
The Error
This error occurs during Spring Boot startup when Liquibase tries to read the master changelog file.
Fix 1: Create the Changelog File in the Correct Location
The default path that Spring Boot expects is src/main/resources/db/changelog/db.changelog-master.yaml:
Create the master changelog:
Fix 2: Match the Configured Path
If you use a custom path in application.properties or application.yml, the file must exist at that path:
If your file uses a different extension (.yml instead of .yaml), update the configuration to match:
Fix 3: Use XML or SQL Format Instead
Liquibase supports multiple changelog formats. If you prefer XML:
Fix 4: Verify Build Output
The file must be present in the compiled output. Check the build directory:
If the directory is empty, the file is not being copied during the build. Verify your build tool configuration:
Fix 5: Disable Liquibase (If Not Needed)
If you are not using Liquibase and it was pulled in as a transitive dependency:
Or exclude the auto-configuration:
Common Pitfalls
- File extension mismatch: Liquibase distinguishes between
.yaml,.yml,.xml, and.sql. If the config says.yamlbut the file is.yml, it will not be found. The extension in the property must exactly match the actual file name. - Wrong directory in multi-module projects: In Maven/Gradle multi-module projects, each module has its own
src/main/resources. The changelog must be in the resources directory of the module that contains the Spring Boot application class, not a sibling module. - IDE not copying resources: Some IDEs cache the build output. After creating the changelog file, run a clean build (
mvn clean compileorgradle clean build) to ensure the file is copied to the output directory. - Using
file:prefix instead ofclasspath:: Thefile:prefix looks for an absolute path on the filesystem, not in the classpath. Useclasspath:for files insrc/main/resources. - Liquibase YAML parsing errors: If the file exists but is malformed YAML (wrong indentation, tabs instead of spaces), Liquibase throws a different error. Validate your YAML syntax separately if the "does not exist" error is resolved but a new error appears.
Summary
- The default changelog path is
src/main/resources/db/changelog/db.changelog-master.yaml - Ensure
spring.liquibase.change-logmatches the actual file path and extension exactly - Check the compiled output directory (
target/classes/orbuild/resources/main/) to verify the file is included in the build - Use
spring.liquibase.enabled=falseto disable Liquibase if it was added as an unwanted transitive dependency - Run a clean build after creating or moving changelog files to clear stale caches

