In my liquibase project I created changeset for Oracle db (dbms = "oracle" in xml file) generated by CustomSqlChange java class. It could be successfully applied directly to my db. But in my main spring project I use SpringLiquibase for repository tests (DBUnit). Such tests use H2 db, and so on CI pipeline only my h2 liquibase changesets are applied.
The problem is that oracle changeset with customSqlChange falls down in CI due to
Caused by: liquibase.exception.CustomChangeException: java.lang.ClassNotFoundException:
P.S. just a piece of code in my spring configuration for liquibase run:
The problem is that oracle changeset with customSqlChange falls down in CI due to
Caused by: liquibase.exception.CustomChangeException: java.lang.ClassNotFoundException:
- ....
- 11:33:20 [error] at liquibase.change.custom.CustomChangeWrapper.setClass(CustomChangeWrapper.java:96)
- 11:33:20 [error] at liquibase.change.custom.CustomChangeWrapper.load(CustomChangeWrapper.java:293)
- 11:33:20 [error] ... 77 more
- 11:33:20 [error] Caused by: java.lang.ClassNotFoundException: com.myClassForCustomSqlChange
- 11:33:20 [error] at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
- 11:33:20 [error] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
- 11:33:20 [error] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
- 11:33:20 [error] at java.lang.Class.forName0(Native Method)
- 11:33:20 [error] at java.lang.Class.forName(Class.java:348)
- 11:33:20 [error] at liquibase.change.custom.CustomChangeWrapper.setClass(CustomChangeWrapper.java:87)
- 11:33:20 [error] ... 78 more
- ....
P.S. just a piece of code in my spring configuration for liquibase run:
@Bean
public SpringLiquibase springLiquibase(@Named(value = "dataSource") DataSource dataSource) {
SpringLiquibase springLiquibase = new SpringLiquibase();
springLiquibase.setDataSource(dataSource);
springLiquibase.setChangeLog(DB_CHANGELOG_MASTER_FILE);
springLiquibase.setIgnoreClasspathPrefix(true);
springLiquibase.setResourceLoader(new PathMatchingResourcePatternResolver());
return springLiquibase;
}