Flyway ERROR: Unable to load on Mac Sierra 10.13
Flyway ERROR: Unable to load on Mac Sierra 10.13
我使用 brew 安装了 flyway,我正在尝试 运行 为 postgres 迁移,但我收到此错误:
Flyway 4.2.0 由 Boxfuse
错误:无法加载 /usr/local/Cellar/flyway/4.2.0/libexec/drivers/postgresql-9.4.1208.jre6.jar
我已经检查过这个路径,目录和文件都存在。
有什么建议吗?
这是 Flyway 4.x 的一个已知问题 (1545),已在版本 5.x
中解决
解决方法:安装版本5.x -- 我提交了一个pull request给Homebrew更新公式
根本原因是 ClassCastException
- 与 Java 9 项更改(issue 3)有关。
运行 带有 -X
标志以查看揭示真正的问题:
$ flyway info -X
Flyway 4.2.0 by Boxfuse
DEBUG: Java 9.0.1 (Oracle Corporation)
DEBUG: Mac OS X 10.13.1 x86_64
DEBUG: Loading config file: /usr/local/Cellar/flyway/4.2.0/libexec/conf/flyway.conf
DEBUG: Unable to load config file: /Users/sdc/flyway.conf
DEBUG: Loading config file: /Users/sdc/code/flytest/flyway.conf
DEBUG: Using configuration:
DEBUG: flyway.jarDirs -> /usr/local/Cellar/flyway/4.2.0/libexec/jars
DEBUG: flyway.driver -> com.mysql.jdbc.Driver
DEBUG: flyway.locations -> filesystem:/usr/local/Cellar/flyway/4.2.0/libexec/sql
DEBUG: flyway.url -> jdbc:mysql://localhost:3306/eddydb
DEBUG: flyway.user -> root
DEBUG: flyway.password -> *********
DEBUG: Adding location to classpath: /usr/local/Cellar/flyway/4.2.0/libexec/drivers/postgresql-9.4.1208.jre6.jar
ERROR: Unexpected error
org.flywaydb.core.api.FlywayException: Unable to load /usr/local/Cellar/flyway/4.2.0/libexec/drivers/postgresql-9.4.1208.jre6.jar
at org.flywaydb.core.internal.util.ClassUtils.addJarOrDirectoryToClasspath(ClassUtils.java:156)
at org.flywaydb.commandline.Main.loadJdbcDrivers(Main.java:305)
at org.flywaydb.commandline.Main.main(Main.java:95)
Caused by: java.lang.ClassCastException: java.base/jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to java.base/java.net.URLClassLoader
at org.flywaydb.core.internal.util.ClassUtils.addJarOrDirectoryToClasspath(ClassUtils.java:151)
... 2 more
我使用 brew 安装了 flyway,我正在尝试 运行 为 postgres 迁移,但我收到此错误:
Flyway 4.2.0 由 Boxfuse
错误:无法加载 /usr/local/Cellar/flyway/4.2.0/libexec/drivers/postgresql-9.4.1208.jre6.jar
我已经检查过这个路径,目录和文件都存在。
有什么建议吗?
这是 Flyway 4.x 的一个已知问题 (1545),已在版本 5.x
中解决解决方法:安装版本5.x -- 我提交了一个pull request给Homebrew更新公式
根本原因是 ClassCastException
- 与 Java 9 项更改(issue 3)有关。
运行 带有 -X
标志以查看揭示真正的问题:
$ flyway info -X
Flyway 4.2.0 by Boxfuse
DEBUG: Java 9.0.1 (Oracle Corporation)
DEBUG: Mac OS X 10.13.1 x86_64
DEBUG: Loading config file: /usr/local/Cellar/flyway/4.2.0/libexec/conf/flyway.conf
DEBUG: Unable to load config file: /Users/sdc/flyway.conf
DEBUG: Loading config file: /Users/sdc/code/flytest/flyway.conf
DEBUG: Using configuration:
DEBUG: flyway.jarDirs -> /usr/local/Cellar/flyway/4.2.0/libexec/jars
DEBUG: flyway.driver -> com.mysql.jdbc.Driver
DEBUG: flyway.locations -> filesystem:/usr/local/Cellar/flyway/4.2.0/libexec/sql
DEBUG: flyway.url -> jdbc:mysql://localhost:3306/eddydb
DEBUG: flyway.user -> root
DEBUG: flyway.password -> *********
DEBUG: Adding location to classpath: /usr/local/Cellar/flyway/4.2.0/libexec/drivers/postgresql-9.4.1208.jre6.jar
ERROR: Unexpected error
org.flywaydb.core.api.FlywayException: Unable to load /usr/local/Cellar/flyway/4.2.0/libexec/drivers/postgresql-9.4.1208.jre6.jar
at org.flywaydb.core.internal.util.ClassUtils.addJarOrDirectoryToClasspath(ClassUtils.java:156)
at org.flywaydb.commandline.Main.loadJdbcDrivers(Main.java:305)
at org.flywaydb.commandline.Main.main(Main.java:95)
Caused by: java.lang.ClassCastException: java.base/jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to java.base/java.net.URLClassLoader
at org.flywaydb.core.internal.util.ClassUtils.addJarOrDirectoryToClasspath(ClassUtils.java:151)
... 2 more