Hello people!
I’m using Liquibase in the following way:
@PostConstruct
protected void updateDataBase() {
try {
Liquibase liquibase = new Liquibase(getChangeLogFilePath(), new ClassLoaderFileOpener(), getDataSource().getConnection());
liquibase.update("");
} catch (Exception ex) {
logger.error("Liquibase error: " + ex.getMessage(), ex);
throw new RuntimeException(ex);
}
}
where getChangeLogFilePath() returns “com/joaosavio/dominio/liquibase/trimpaperChangeLog-master.xml”. But it’s returning FileNotFound!
Inside my application.ear
-META-INF
-lib
-ejb-shared.jar
-ejb.jar
-com/joaosavio/ejb/…
-
com/joaosavio/dominio/liquibase/trimpaperChangeLog-master.xml
-web.war
I’ve also tried get the file as a resource doing URL url = getClass().getResource("/com/joaosavio/dominio/liquibase/trimpaperChangeLog-master.xml") and works, but as far I’m concerned Liquibase works with the file fullpath and there is no guarantee that url will return a valid file path (in fact this problem is happenning).
Is there another way to run Liquibase? Does liquibase accepts an InputStream as input? Any other idea???