java - illegalStateException Cannot find changelog location class path resource liquibase
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
This Liquibase error means Spring Boot or Liquibase was told to load a changelog from the classpath, but the file is not actually present at that location in the built application. The fix is usually straightforward: put the changelog under the resources directory, point spring.liquibase.change-log at the real packaged path, and verify the file makes it into the final JAR.
Understand the Expected Default
In Spring Boot, Liquibase looks for a default master changelog under db/changelog/db.changelog-master.yaml unless you override it. If your project uses a different path or file type, configure it explicitly instead of relying on a guessed location.
A standard application.yml entry looks like this:
The classpath: prefix means the file must exist inside the packaged application resources, not just somewhere in the source tree.
Put the File in the Right Source Directory
For a normal Maven or Gradle Java project, Liquibase changelogs belong under src/main/resources. Example structure:
If the file sits under src/main/java, src/test/resources, or some custom folder that is not copied into the runtime classpath, Liquibase will fail at startup even though the file exists in your repository.
Verify the Path Matches Exactly
Small path differences cause this exception all the time. Common problems include:
- '
changelogversuschangeLog' - '
.yamlversus.yml' - missing leading slash after
classpath: - referring to a folder name such as
liquibasethat does not contain the expected master file
A safe configuration is:
If you use XML or SQL instead, point to the real filename rather than the directory.
Confirm the File Is Packaged into the Build Output
The source path can be correct while the build output is still wrong because of resource filtering or custom packaging rules. Check the compiled artifact directly.
For a Maven project:
For a Gradle project:
If the changelog is not inside the JAR, the problem is not Liquibase itself. It is your build resource configuration.
Example Spring Boot Setup
A minimal working configuration keeps the changelog location explicit and easy to trace.
And a minimal changelog file:
If this structure works but your real project does not, compare the two setups and find the packaging or path difference.
Watch for Multi-Module and Test-Only Confusion
In multi-module projects, the changelog may live in one module while the Spring Boot app starts from another. In that case, the runtime module must depend on the resource-containing module so the changelog lands on the final classpath.
Another common issue is having the file only in src/test/resources. That works during some test runs and then fails in production packaging.
Common Pitfalls
One mistake is pointing spring.liquibase.change-log to a directory instead of a file. Liquibase needs the master changelog file, not just the folder name.
Another mistake is fixing the path in source code but never checking the built JAR. If the resource is filtered out during packaging, the startup exception remains.
Developers also sometimes mix absolute file paths and classpath locations across environments. Pick one strategy and keep it consistent.
Finally, do not assume the default Boot changelog location matches your project layout. If you moved the file, set the property explicitly.
Summary
- Liquibase must load a real changelog file from the runtime classpath.
- Put changelogs under
src/main/resourcesunless you have a custom packaging strategy. - Set
spring.liquibase.change-logto the exact packaged file path. - Inspect the built JAR when the file seems to exist but startup still fails.
- Multi-module packaging and path typos are the most common causes of this exception.
Related reading
- Java - JPA - Version annotation
- Java - Removing duplicates in an ArrayList
- Java - removing first character of a string
- Java - sending HTTP parameters via POST method easily
- Java 8 Class JavaLaunchHelper is implemented in both
- java 8 Docker Improperly specified VM option 'InitialRAMPercentageXX
- Java - Sort one array based on values of another array?
- Java 11 on AWS beanstalk for Spring boot project

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.