Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Liquibase: receiving "file does not exist" exception when file exists for changelog.xml

I am attempting to implement a java triggered liquibase database update.

I have the following code:

java.sql.Connection connection = openConnection(eventContext); 
Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(connection));
String changelog = UpgradePanDatabase.class.getResource("/liquibase/db.changelog.xml").getPath();
Liquibase liquibase = new liquibase.Liquibase(changelog, new ClassLoaderResourceAccessor(), database);
liquibase.update(new Contexts(), new LabelExpression());
connection.close();

but I receive the following ChangeLogParseException:

/Users/ntregillus/myApp/.mule/apps/myApp/classes/liquibase/db.changelog.xml does not exist

But I know the file exists, I can copy the path, and open it directly from the terminal, and also find it within the File Explorer. Why is Liquibase not able to find this file?

like image 630
Nathan Tregillus Avatar asked Oct 14 '25 21:10

Nathan Tregillus


1 Answers

The most likely cause is that the changelog is not being packaged as a resource in the jar file. Check the structure of the packaged jar rather than your local developer working copy.

like image 168
SteveDonie Avatar answered Oct 17 '25 09:10

SteveDonie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!