无法使用liquibase独立shell脚本 [英] unable to use liquibase standalone shell script
问题描述
(通过问题解答"分享我自己的解决方法)
(Sharing my own workaround via Q/A)
从liquibase-3.6.2-bin.tar.gz
版本尝试将liquibase作为独立的shell脚本运行时,出现以下错误:
I was getting the following error while trying to run liquibase as a standalone shell script, from the liquibase-3.6.2-bin.tar.gz
release:
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脚本之后,我下载了这两个项目的jar:
After some googling and inspecting the liquibase
shell script, I downloaded jars for these two projects:
- https://logback.qos.ch/download.html
- https://www.slf4j.org/download.html
然后我创建了一个相对于liquibase
所在位置的./lib
目录,并将以下jar链接到其中:
Then I created a ./lib
directory relative to where the liquibase
lives and symlinked into it the following 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起作用了.
After these steps the command line liquibase worked.
I agree with these points made by one of the posters in this thread, sinc currently would be difficult to use liquibase as a standalone utility:
1)此版本缺少必需的库才能自足. 2)进一步:Liquibase jar的包装应从使用lib/文件夹转换为具有所有必需条件的Uber jar 包括库.
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中尚未修复.
There appears to be a bug report for the same issue in 3.6.0, but at least for me in 3.6.2 it has not been fixed.
推荐答案
在谷歌搜索并检查了liquibase shell脚本之后,我下载了这两个项目的jar:
After some googling and inspecting the liquibase shell script, I downloaded jars for these two projects:
- https://logback.qos.ch/download.html
- https://www.slf4j.org/download.html
然后我创建了一个相对于liquibase所在目录的./lib目录,并将以下jar链接到其中:
Then I created a ./lib directory relative to where the liquibase lives and symlinked into it the following 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起作用了.
After these steps the command line liquibase worked.
我同意本主题中一位发帖人的观点,因为目前很难将liquibase用作独立实用程序:
I agree with these points made by one of the posters in this thread, since currently it would be difficult to use liquibase as a standalone utility:
1)此版本缺少必需的库才能自足. 2)另外:Liquibase罐子的包装应从 利用lib/文件夹成为具有所有必需库的Uber jar 包括在内.
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中尚未得到修复.
There appears to be a bug report for the same issue in 3.6.0, but at least for me in 3.6.2 it has not been fixed.
这篇关于无法使用liquibase独立shell脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!