Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flyway ERROR: Unable to load on Mac Sierra 10.13

I installed flyway using brew and I'm trying to to run a migrate for a postgres and I'm getting this error:

Flyway 4.2.0 by Boxfuse

ERROR: Unable to load /usr/local/Cellar/flyway/4.2.0/libexec/drivers/postgresql-9.4.1208.jre6.jar

I've checked this path and the directories and files exists.

Any Suggestions ?

like image 906
user3481782 Avatar asked Oct 17 '22 02:10

user3481782


1 Answers

This is a known issue (1545) with Flyway 4.x that was resolved with version 5.x

Solution: Install version 5.x -- I submitted a pull request to Homebrew to update the formula


Root cause is a ClassCastException - related to a Java 9 changes (issue 3).

Run with -X flag to see reveal the real issue:

$ 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
like image 62
sdc Avatar answered Oct 23 '22 16:10

sdc