I want to use liquibase but when I want to let it run with command line this happens:
PS C:\Users\Ferid\Downloads\liquibase-3.6.0-bin> .\liquibase
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: ch/qos/logback/core/filter/Filter
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.core.filter.Filter
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more
I have tried liquibase-3.6.1 and now liquibase-3.6.0
In this article, we'll cover what you can do once you've created a database changelog file and you're ready to go: Embed Liquibase into your product. Embed Liquibase into your build tools. Run Liquibase to generate SQL for review.
One of the required libraries is missing from the library folder.
See the bug report link below where another user had the same issue.
It appears 3.6.1 is still missing slf4j-api-1.7.25 in the lib folder and I still receive an error invoking liquibase via cli.
You have three options:
See here for the bug report: https://liquibase.jira.com/browse/CORE-3201
You must add this libraries to your classpath:
In my case I am using Spring Boot liquibase integration, so, here is my build.gradle
liquibase configutarion
buildscript {
dependencies {
classpath 'org.postgresql:postgresql:9.4.1211.jre7'
classpath 'org.liquibase:liquibase-core:3.6.3'
classpath "org.liquibase:liquibase-gradle-plugin:2.0.1"
}
}
plugins {
id 'org.springframework.boot' version '2.1.3.RELEASE'
id 'java'
id "org.liquibase.gradle" version "2.0.1"
}
dependencies {
liquibaseRuntime 'org.postgresql:postgresql:9.4.1211.jre7'
liquibaseRuntime 'org.liquibase:liquibase-core:3.6.3'
liquibaseRuntime 'org.liquibase:liquibase-groovy-dsl:2.0.1'
liquibaseRuntime 'ch.qos.logback:logback-core:1.2.3'
liquibaseRuntime 'ch.qos.logback:logback-classic:1.2.3'
}
def changeLog = "$projectDir/src/main/db/changelog.xml"
liquibase {
activities {
main {
changeLogFile changeLog
url 'jdbc:postgresql://localhost:5431/postgres'
username 'postgres'
password 'postgres'
}
}
}
It's an extract from liquibase-gradle-plugin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With