0

Trying to use flyway command line with locations pointing to s3 bucket.

./flyway -locations=s3://my-test-made-up-bucket-6955 -url=$url -user=$uname -password=$pwd migrate -X

Output fails with java.lang.NoClassDefFoundError:

Flyway Community Edition 9.3.1 by Redgate
See what's new here: https://flywaydb.org/documentation/learnmore/releaseNotes#9.3.1

DEBUG: AWS SDK available: true
DEBUG: Google Cloud Storage available: true
DEBUG: Loading config file: /usr/bin/flyway-9.3.1/conf/flyway.conf
DEBUG: Unable to load config file: /root/flyway.conf
DEBUG: Unable to load config file: /usr/bin/flyway-9.3.1/flyway.conf
DEBUG: Using configuration:
DEBUG: flyway.jarDirs -> /usr/bin/flyway-9.3.1/jars
DEBUG: flyway.locations -> s3://my-test-made-up-bucket-6955
DEBUG: flyway.password -> ********************************
DEBUG: flyway.url -> jdbc:sqlserver://***:****;databaseName=****;encrypt=true;trustServerCertificate=true;
DEBUG: flyway.user -> dbusradm
DEBUG: Multiple databases found that handle url 'jdbc:sqlserver://***:****;databaseName=****;encrypt=true;trustServerCertificate=true;'
DEBUG: Scanning for classpath resources at 'classpath:db/callback' ...
DEBUG: Determining location urls for classpath:db/callback using ClassLoader java.net.URLClassLoader@6f1de4c7 ...
DEBUG: Unable to resolve location classpath:db/callback.
Exception in thread "main" java.lang.NoClassDefFoundError: software/amazon/awssdk/core/exception/SdkClientException
at org.flywaydb.core.internal.scanner.Scanner.<init>(Scanner.java:90)
at org.flywaydb.core.FlywayExecutor.createResourceAndClassProviders(FlywayExecutor.java:251)
at org.flywaydb.core.FlywayExecutor.execute(FlywayExecutor.java:134)
at org.flywaydb.core.Flyway.info(Flyway.java:193)
at org.flywaydb.commandline.Main.executeOperation(Main.java:285)
at org.flywaydb.commandline.Main.main(Main.java:179)
Caused by: java.lang.ClassNotFoundException: software.amazon.awssdk.core.exception.SdkClientException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 6 more

Added the jars after building mvn project from source https://github.com/aws/aws-sdk-java-v2

Copied onto the flyway jars folder like described in here https://flywaydb.org/documentation/addingToTheClasspath

The debug is printing the correct s3 location, but why is 'classpath:db/callback' also being searched for? Is there any configuration that needs to be set?

  • 1
    Have you read the [Locations](https://flywaydb.org/documentation/configuration/parameters/locations) documentation? Did you notice: _To use AWS S3, the AWS SDK **v2** and dependencies must be included, and configured for your S3 account._ – AlwaysLearning Sep 29 '22 at 03:52

0 Answers0