无法使用 liquibase 独立 shell 脚本
unable to use liquibase standalone shell script
(通过 Q/A 分享我自己的解决方法)
我在尝试 运行 liquibase 作为独立 shell 脚本时收到以下错误,来自 liquibase-3.6.2-bin.tar.gz
版本:
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(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.core.filter.Filter
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
█
在谷歌搜索和检查 liquibase
shell 脚本后,我为这两个项目下载了 jars:
然后我创建了一个相对于 liquibase
所在位置的 ./lib
目录,并将以下 jars 符号链接到其中:
- logback-classic-1.2.3.jar
- logback-core-1.2.3.jar
- slf4j-api-1.7.25.jar
- slf4j-simple-1.7.25.jar
完成这些步骤后,命令行 liquibase 开始工作。
我同意 this thread 中的一位发帖人提出的这些观点,因为目前很难将 liquibase 用作独立实用程序:
1) This release is missing a required library to be self-sufficient.
2) Further more: The packaging of the Liquibase jar should switch from utilizing a lib/ folder to being an Uber jar with all required
libs included.
在 3.6.0 中似乎有一个针对相同问题的 bug report,但至少对我来说,在 3.6.2 中它还没有被修复。
在谷歌搜索和检查 liquibase shell 脚本后,我为这两个项目下载了 jars:
然后我创建了一个相对于 liquibase 所在位置的 ./lib 目录,并将以下 jars 符号链接到其中:
- logback-classic-1.2.3.jar
- logback-core-1.2.3.jar
- slf4j-api-1.7.25.jar
- slf4j-simple-1.7.25.jar
完成这些步骤后,命令行 liquibase 开始工作。
我同意该帖子中的一位发帖人提出的这些观点,因为目前很难将 liquibase 用作独立实用程序:
1) This release is missing a required library to be self-sufficient.
2) Further more: The packaging of the Liquibase jar should switch from
utilizing a lib/ folder to being an Uber jar with all required libs
included.
在 3.6.0 中似乎有一个针对同一问题的错误报告,但至少对我来说,在 3.6.2 中它还没有被修复。
liquibase有依赖,很正常
您可以使用构建工具构建一个 uberjar 或构建一个 lib 文件夹(包含所需的依赖项),又名 maven 或 gradle。
此外,它允许您打包脚本脚本以从命令行启动数据库更新,例如 Zip 格式。
(通过 Q/A 分享我自己的解决方法)
我在尝试 运行 liquibase 作为独立 shell 脚本时收到以下错误,来自 liquibase-3.6.2-bin.tar.gz
版本:
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(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.core.filter.Filter
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
█
在谷歌搜索和检查 liquibase
shell 脚本后,我为这两个项目下载了 jars:
然后我创建了一个相对于 liquibase
所在位置的 ./lib
目录,并将以下 jars 符号链接到其中:
- logback-classic-1.2.3.jar
- logback-core-1.2.3.jar
- slf4j-api-1.7.25.jar
- slf4j-simple-1.7.25.jar
完成这些步骤后,命令行 liquibase 开始工作。
我同意 this thread 中的一位发帖人提出的这些观点,因为目前很难将 liquibase 用作独立实用程序:
1) This release is missing a required library to be self-sufficient. 2) Further more: The packaging of the Liquibase jar should switch from utilizing a lib/ folder to being an Uber jar with all required libs included.
在 3.6.0 中似乎有一个针对相同问题的 bug report,但至少对我来说,在 3.6.2 中它还没有被修复。
在谷歌搜索和检查 liquibase shell 脚本后,我为这两个项目下载了 jars:
然后我创建了一个相对于 liquibase 所在位置的 ./lib 目录,并将以下 jars 符号链接到其中:
- logback-classic-1.2.3.jar
- logback-core-1.2.3.jar
- slf4j-api-1.7.25.jar
- slf4j-simple-1.7.25.jar
完成这些步骤后,命令行 liquibase 开始工作。
我同意该帖子中的一位发帖人提出的这些观点,因为目前很难将 liquibase 用作独立实用程序:
1) This release is missing a required library to be self-sufficient. 2) Further more: The packaging of the Liquibase jar should switch from utilizing a lib/ folder to being an Uber jar with all required libs included.
在 3.6.0 中似乎有一个针对同一问题的错误报告,但至少对我来说,在 3.6.2 中它还没有被修复。
liquibase有依赖,很正常
您可以使用构建工具构建一个 uberjar 或构建一个 lib 文件夹(包含所需的依赖项),又名 maven 或 gradle。
此外,它允许您打包脚本脚本以从命令行启动数据库更新,例如 Zip 格式。