简体   繁体   中英

liquibase.exception.ChangeLogParseException: ChangeLogFile does not exists

public static void main(String[] args) throws Exception {
    //execute("jdbc:postgresql://localhost:5432/JAVA_Test", "Admin", "123456", "org.postgresql.Driver");
    execute("jdbc:jtds:sqlserver://localhost:5432/Liquibase_JAVA", "sa", "123456!", "net.sourceforge.jtds.jdbc.Driver");
}

public static void execute(String url, String userName, String password, String driver) throws Exception  {
    DatabaseConnection dbConnection = new DatabaseConnection(url, driver, userName, password);
    Connection conn = dbConnection.getConnection();
    Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(conn));
    String changeLog = "/job_executor/liquibasechangelog/databaseChangeLog.xml";
    Liquibase liquibase = new Liquibase(changeLog, new FileSystemResourceAccessor(), database);
    liquibase.update(null);
    conn.close();
}

I have my changeLogFile inside my project. It's kind of weird that i'm getting an error changeLogFile.xml does not exists.

Can anyone help me with this, THanks

Most likely your change log file is not there:

/job_executor/liquibasechangelog/databaseChangeLog.xml

but there:

job_executor/liquibasechangelog/databaseChangeLog.xml

Please notice the / missing in the second path so it will be relative, not absolute.

I have fixed it, by adding the liquibasechangelog folder (where my xml files resides) to the build path and then by referring it just by the file name instead of path to the file name

just like this

String changeLog = "databaseChangeLog.xml";

THanks @DavidX @MichalRorat

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM