1
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

1
  • You reference changeLogFile.xml but in your description, but in your code you're using databaseChangeLog.xml. Are you sure the file with the name in the code exists? Commented Jan 26, 2018 at 0:57

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Did you try to execute cat job_executor/liquibasechangelog/databaseChangeLog.xml from the place where you are executing your java?
1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.