Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command line arguments don't seem to be passed to the Liquibase CLI when using the v3.0.0 plugin #154

Closed
marques-work opened this issue Aug 30, 2024 · 24 comments

Comments

@marques-work
Copy link

We're having trouble upgrading the gradle plugin from v2.2.2 to v3.0.0 in our Kotlin project.

Not sure if the Kotlin Gradle DSL is the exact issue or if I'm just doing something stupid and aren't understanding the upgrade instructions. All the examples are using the Groovy DSL, so I'm not ruling it out. While our project is a multi-project/submodule setup (I read the note about setting -Duser.dir) I see the same behavior in a single root module setup as well.

I've tried my best to distill this in a reproducible test project: https://github.com/marques-work/liquibase-gradle-3.0.0-test

Anyhow, according to the output, it doesn't seem like any command-line args are being set at all. I'm setting the following basic args:

  • changelog-file
  • search-path
  • url
  • driver
  • username
  • password

No arguments are being passed to the update command according to debug output. I keep getting this missing --changelog-file argument error.

I've tried variations of this in the Map configured in the liquibase { ... } block, such as:

  • --changelog-file
  • changlog-file
  • changelogfile
  • changelogFile (as in the docs)
  • changeLogFile (not supposed to work in the new version, but tried for good measure anyway)

At this point, I've given up and am reaching out for help. Yes, I've added the buildscript block with the classpath dependencies. I'm using the latest liquibase version and picocli version as of today (4.29.1 and 4.7.6, respectively).

If you could look at the repo I linked above, I think the instructions are pretty clear. In summary, the main branch is a working example using v2.2.2 of the plugin. The upgrade branch is the broken project using v3.0.0.

Please tell me what I'm doing wrong (or if this is a real bug, help me understand and maybe guide me to submit a bugfix PR).

@marques-work
Copy link
Author

@stevesaliman you appear to be the core maintainer, so just tagging you here :).

@marques-work
Copy link
Author

FWIW, here's the output I'm seeing:
image

@stevesaliman
Copy link
Collaborator

stevesaliman commented Aug 31, 2024

Thank you for the test project, it is very helpful because I now have something that fails on my system :-)

There are a couple of things going on there that I'm trying to chase down...

First of all, the groovy DSL should work the same with Kotlin as it does with groovy, so no issue there. The DSL does expect camelCase arguments, so you'll want to update the build file to use searchPath and changelogFile.

Second, if you add liquibaseRuntime(files("src/main/resources")) to the build.gradle.kts file, you won't need searchPath, because the file will already be in a location Liquibase searches.

The thrid thing is the real head scratcher. If I run gradlew update --debug the command fails, and I see in the log that the plugin skips all the command arguments because it thinks they are not supported by the update command. You can further see in the log that it runs liquibase with no arguments.

However If I add --no-daemon -Dorg.gradle.debug=true to the end of the command so I can debug the plugin, the command works. I can see liquibase called correctly, the file is found, the update suceeds. I have no idea why running in the debugger would make a difference, but whatever it is, I strongly suspect it is a duplicate of #151

@chschu
Copy link

chschu commented Sep 4, 2024

I had the same issue, and starting with --debug reveals the following log entries:

2024-09-04T14:31:00.536+0200 [DEBUG] [org.gradle.api.Project] skipping the changelogFile command argument because it is not supported by the update
2024-09-04T14:31:00.536+0200 [DEBUG] [org.gradle.api.Project] skipping the logLevel command argument because it is not supported by the update
2024-09-04T14:31:00.536+0200 [DEBUG] [org.gradle.api.Project] skipping the password command argument because it is not supported by the update
2024-09-04T14:31:00.537+0200 [DEBUG] [org.gradle.api.Project] skipping the searchPath command argument because it is not supported by the update
2024-09-04T14:31:00.537+0200 [DEBUG] [org.gradle.api.Project] skipping the url command argument because it is not supported by the update
2024-09-04T14:31:00.537+0200 [DEBUG] [org.gradle.api.Project] skipping the username command argument because it is not supported by the update

There seems to be an issue detecting the supported command arguments starting with Liquibase version 4.27.0. The release notes don't contain any suspicious changes.

@marques-work
Copy link
Author

@stevesaliman sorry for the late reply, just returning from an extra long weekend. Thanks so much for looking into this. That is so weird, regarding debug output affecting its behavior.

Honestly I probably won't have much time to debug this code to figure out why it thinks these args are unsupported, but I'll see if I can slice out some time. In the meanwhile, I'll see if the workaround with liquibaseRuntime() you suggested helps me move along.

@timrs2998
Copy link

timrs2998 commented Sep 5, 2024

Here is how I'm using it in Kotlin and I'm encountering similar issues:

// build.gradle.kts
liquibase {
    jvmArgs = "-Duser.dir=$projectDir"
    runList = "main"
    activities.register("main") {
        this.arguments =
            mapOf(
                "changelogFile" to "src/main/resources/db/changelog/build-changelog.yaml",
                "url" to "jdbc:postgresql://localhost:5433/postgres",
                "username" to "pguser",
                "password" to "pguser",
            )
    }
}

Logs:

$ ./gradlew update             
> Task :xxxxxx:update FAILED
liquibase-plugin: Running the 'main' activity...
####################################################
..
####################################################
Starting Liquibase at 12:56:15 using Java 17 (version 4.29.2 #3683 built at 2024-08-29 16:45+0000)
Liquibase Version: 4.29.2
WARNING: License service not loaded, cannot determine Liquibase Pro license status. Please consider re-installing Liquibase to include all dependencies. Continuing operation without Pro license.
Error parsing command line: Invalid argument '--changelog-file': missing required argument. If you need to configure new liquibase project files and arguments, run the 'liquibase init project' command.

For detailed help, try 'liquibase --help' or 'liquibase <command-name> --help'

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':xxxxxx:update'.
> Process 'command '/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 1s
5 actionable tasks: 2 executed, 3 up-to-date

However If I add --no-daemon -Dorg.gradle.debug=true to the end of the command so I can debug the plugin, the command works

I'm also noticing this behavior as the commands work when running with the debugger, but fail without the debugger.

@daniloalexandre
Copy link

daniloalexandre commented Sep 6, 2024

I'm facing the same behavior using groovy. I followed the instructions in Usage.

I created a project from Spring Starter Project in STS. I'm using JAVA 17 and Gralde 8.8. The dependencies versions are explicited in build.gradle.

You may see the build.gradle content here:

buildscript {
  dependencies {
    classpath 'org.liquibase:liquibase-core:4.27.0' //I don't know why, but it is necessary to command line finds the classes
  }
}

plugins {
	id 'java'
	id 'org.springframework.boot' version '3.3.3'
	id 'io.spring.dependency-management' version '1.1.6'
	id 'org.liquibase.gradle' version '3.0.0'
}

group = 'br.subscribe'
version = '0.0.1-SNAPSHOT'

java {
	toolchain {
		languageVersion = JavaLanguageVersion.of(17)
	}
}

configurations {
	compileOnly {
		extendsFrom annotationProcessor
	}
	
	liquibaseRuntime.extendsFrom runtime
}

repositories {
	mavenCentral()
}

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
	implementation 'org.springframework.boot:spring-boot-starter-web'
	implementation 'org.liquibase:liquibase-core:4.27.0'
	compileOnly 'org.projectlombok:lombok'
	developmentOnly 'org.springframework.boot:spring-boot-devtools'
	runtimeOnly 'com.h2database:h2'
	runtimeOnly 'mysql:mysql-connector-java:5.1.34'
	annotationProcessor 'org.projectlombok:lombok'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'
	testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
	
	liquibaseRuntime 'org.liquibase:liquibase-core:4.27.0'
  	liquibaseRuntime 'org.liquibase:liquibase-groovy-dsl:3.0.2'
  	liquibaseRuntime 'info.picocli:picocli:4.6.1'
  	liquibaseRuntime 'com.h2database:h2'
  	liquibaseRuntime 'mysql:mysql-connector-java:5.1.34'
  	liquibaseRuntime 'javax.xml.bind:jaxb-api:2.3.1'
  	liquibaseRuntime 'org.liquibase.ext:liquibase-hibernate5:3.6' 
  	liquibaseRuntime 'ch.qos.logback:logback-core:1.2.3'
  	liquibaseRuntime 'ch.qos.logback:logback-classic:1.2.3'
  	liquibaseRuntime sourceSets.main.output
}

if(!project.hasProperty('runList')){
	project.ext.runList = 'main'
}

project.ext.diffChangelogFile = '${buildDir}/' + new Date().format('yyyyMMddHHmmss') + '_changelog.xml'

liquibase {
    activities {
        main {
            driver 'org.h2.Driver'
            url 'jdbc:h2:file:./h2db/subscribe_db;DB_CLOSE_DELAY=-1;AUTO_SERVER=true;MODE=MYSQL;'
            username 'sa'
            password ' '
            changelogFile 'src/main/resources/db/changelog/master.xml'
            logLevel 'debug'
        }
        
        diffLog {
            driver 'org.h2.Driver'
            url 'jdbc:h2:file:./h2db/subscribe_db;DB_CLOSE_DELAY=-1;AUTO_SERVER=true;MODE=MYSQL;'
            username 'sa'
            password ' '
            changelogFile project.ext.diffChangelogFile
            referenceUrl 'hibernate:spring:br.subscribe.domain?dialect=org.hibernate.dialect.H2Dialect'
            logLevel 'debug'
        }

    }

    runList = project.ext.runList
}

tasks.named('test') {
	useJUnitPlatform()
}

You also may see the application.yaml content here:

spring:
  application:
    name: api-subscribe
################################
# H2 Database (DEV)
################################
---
spring:
  h2:
    console:
      enabled: true
      path: /h2-console
  datasource:
    driver-class-name: org.h2.Driver
    url: jdbc:h2:file:./h2db/subscribe_db;DB_CLOSE_DELAY=-1;AUTO_SERVER=true;MODE=MYSQL;
    username: sa
    password:
################################
# LIQUIBASE
################################
---
spring:
  liquibase:
    changeLog: 'classpath:/db/changelog/master.xml'

The error occours when i run the command line:

gradlew diffChangeLog -PrunList=diffLog

> Task :diffChangelog
liquibase-plugin: Running the 'diffLog' activity...
####################################################
##   _     _             _ _                      ##
##  | |   (_)           (_) |                     ##
##  | |    _  __ _ _   _ _| |__   __ _ ___  ___   ##
##  | |   | |/ _` | | | | | '_ \ / _` / __|/ _ \  ##
##  | |___| | (_| | |_| | | |_) | (_| \__ \  __/  ##
##  \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___|  ##
##              | |                               ##
##              |_|                               ##
##                                                ##
##  Get documentation at docs.liquibase.com       ##
##  Get certified courses at learn.liquibase.com  ##
##                                                ##
####################################################
Starting Liquibase at 10:33:21 (version 4.27.0 #1525 built at 2024-03-25 17:08+0000)
Liquibase Version: 4.27.0
WARNING: License service not loaded, cannot determine Liquibase Pro license status. Please consider re-installing Liquibase to include all dependencies. Continuing operation without Pro license.
Error parsing command line: Invalid argument '--changelog-file': missing required argument. If you need to configure new liquibase project files and arguments, run the 'liquibase init project' command.

For detailed help, try 'liquibase --help' or 'liquibase <command-name> --help'

> Task :diffChangelog FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':diffChangelog'.
> Process 'command 'C:\Program Files\Java\jdk-17.0.1\bin\java.exe'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 6s
1 actionable task: 1 executed

Anyone can help me to find what's wrong in those configurations ?

@stevesaliman
Copy link
Collaborator

I think I may have figured out what is going on. I'll add details to the issue if my hunch proves correct.

I pushed an update to the code, but I haven't released a new version yet. @marques-work @timrs2998 @daniloalexandre can you build a local version of the plugin and see if the latest code solves your issues? You can publish the 3.0.1-SNAPSHOT of the plugin to a local repo with the gradlew pTML command. To get your project to use it, mke sure you have a block like this in build.gradle:

buildscript {
  repositories {
    mavenLocal()
    mavenCentral()
    gradlePluginPortal()
  }
}

The key is to see how the plugin calls Liquibase. If you with --debug, there will be a line in the log that starts with running 'lquibase. If the bug is fixed, it should look something like this:

Running 'liquibase --driver=org.postgresql.Driver --search-path=/home/steve/projects/tmp/liquibase-gradle-3.0.0-test/src/main/resources update --changelog-file=changelog.xml --password=12345 --url=jdbc:postgresql://localhost:6432/postgres --username=1234'

If not, it will just say Running 'liquibase update', with no arguments.

@marques-work
Copy link
Author

marques-work commented Sep 9, 2024

@stevesaliman thanks for the quick fix -- it works! I do have some updated instructions for others trying to test fix because the instructions listed above didn't work for me.

Testing the locally built plugin: how to get this to work

Building the plugin

I'm using JDK 21 by default, so if you are too, building the new plugin version won't work because it's not compatible with Gradle 7 (used by the plugin). I'm using asdf so I just chose JDK 11 as a the lowest common denominator, so that worked for me (I was getting complaints about the *.class files reporting an unsupported major version under my gradle cache folder). Once you switch to a supported JDK, ./gradlew pTML works as expected.

Resolving the newly built snapshot

For me, the repositories {} block didn't work under buildscript {}. In fact, this was quite a bit of trouble because it seems like when searching the local maven repo (~/.m2/*) it's looking for a totally different artifact ID than one would expect.

Plugin Repositories (could not resolve plugin artifact 'org.liquibase.gradle:org.liquibase.gradle.gradle.plugin:3.0.1-SNAPSHOT')

Important

Note the weird artifact ID!

Anyway, I hacked it to work so here's the combination that worked for me:

Under settings.gradle.kts, I needed a pluginManagement {} block. Under here, I needed to set the maven repos to resolve the new artifact plus a custom resolution strategy to map the artifact that gradle was trying to resolve with the one that was actually published. Really weird, but this seems to be the way that my test project works (quite a vanilla Gradle 8.10 project using the Kotlin DSL and JDK 21). You can see the exact build scripts under my upgrade-3.0.1-SNAPSHOT branch in the test repo I linked above, but basically this is what I put in my settings.gradle.kts:

pluginManagement {
  repositories {
    mavenLocal()
    mavenCentral()
    gradlePluginPortal()
  }

  resolutionStrategy {
    eachPlugin {
      if (requested.id.id == "org.liquibase.gradle") {
        useModule("org.liquibase:liquibase-gradle-plugin:3.0.1-SNAPSHOT")
      }
    }
  }
}

I didn't need to add anything to the buildscript {} block. Just this.

Once I did that, I could build my project. After that, worked like a charm!

I can now see my migration in the databasechangelog table!

image

@marques-work marques-work changed the title Command line arguments don't seem to be set in Gradle Kotlin projects in v3.0.0 Command line arguments don't seem to be set in Gradle projects when using the v3.0.0 plugin Sep 9, 2024
@marques-work
Copy link
Author

@stevesaliman once you tag/release a new version, please close this issue as you see fit. Thanks again!

@marques-work
Copy link
Author

@stevesaliman sorry I made an incorrect comment (now deleted) earlier about it still not working, but that was my mistake. I'm not sure what happened but I can't reproduce it anymore. Sorry for the false alarm. It seems to work just fine, with or without the debug log setting.

@marques-work marques-work changed the title Command line arguments don't seem to be set in Gradle projects when using the v3.0.0 plugin Command line arguments don't seem to be passed to the Liquibase CLI when using the v3.0.0 plugin Sep 9, 2024
@daniloalexandre
Copy link

daniloalexandre commented Sep 9, 2024

@stevesaliman , thank's for the quick answer.

Sorry, but it's still failing to me.

I did the same workaround from @marques-work that forces the gradlew recognizes the 3.0.1-SNAPSHOT version:

see the settings.gradle:

 pluginManagement {
    repositories {
        mavenLocal()
        mavenCentral()
        gradlePluginPortal()
    }
    
    resolutionStrategy {
	    eachPlugin {
	      if (requested.id.id == "org.liquibase.gradle") {
	        useModule("org.liquibase:liquibase-gradle-plugin:3.0.1-SNAPSHOT")
	      }
	    }
	  }
}

rootProject.name = 'api-subscribe'

The only change in build.gradle file was the plugin's version:

plugins {
	id 'java'
	id 'org.springframework.boot' version '3.3.3'
	id 'io.spring.dependency-management' version '1.1.6'
	id 'org.liquibase.gradle' version '3.0.1-SNAPSHOT'
}

However, the same issue persists.

Looking at the logs, using '--debug' argument, we can see the liquibase running without arguments:

...
2024-09-09T09:50:27.962-0300 [QUIET] [system.out] liquibase-plugin: Running the 'diffLog' activity...
2024-09-09T09:50:27.962-0300 [DEBUG] [org.gradle.api.Project] liquibase-plugin: The liquibase.integration.commandline.LiquibaseCommandLine class will be used to run Liquibase
2024-09-09T09:50:27.962-0300 [DEBUG] [org.gradle.api.Project] liquibase-plugin: Liquibase will be run with the following jvmArgs: []
2024-09-09T09:50:27.962-0300 [DEBUG] [org.gradle.api.Project] liquibase-plugin: Running 'liquibase diff-changelog'

...

Error parsing command line: Invalid argument '--changelog-file': missing required argument. If you need to configure new liquibase project files and arguments, run the 'liquibase init project' command.

@marques-work
Copy link
Author

marques-work commented Sep 9, 2024

@daniloalexandre did you try running without daemons? I wonder if that matters. For me, I killed any leftover gradle daemons when I ran.

FWIW, I thought I saw an error like yours too after the update, but it went away after i killed all daemons, tore down my containers, ran git clean -ffdx on my test repo. Maybe there's something weird with that?

@daniloalexandre
Copy link

daniloalexandre commented Sep 9, 2024

Hi, @marques-work , thanks for your help.

When I run the command gradlew diffChangeLog -PrunList=diffLog --no-deamon the liquibase parameters are found, however another error occurs:

ERROR: Exception Primary Reason:  Driver class was not specified and could not be determined from the url (hibernate:spring:br.subscribe.domain?dialect=org.hibernate.dialect.H2Dialect)

I have no idea why this is happening, because there's a liquibase parameter configured with the driver. =/

   driver 'org.h2.Driver'

here is the full log:

To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.8/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation.
Daemon will be stopped at the end of the build

> Task :diffChangelog
liquibase-plugin: Running the 'diffLog' activity...
####################################################
##   _     _             _ _                      ##
##  | |   (_)           (_) |                     ##
##  | |    _  __ _ _   _ _| |__   __ _ ___  ___   ##
##  | |   | |/ _` | | | | | '_ \ / _` / __|/ _ \  ##
##  | |___| | (_| | |_| | | |_) | (_| \__ \  __/  ##
##  \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___|  ##
##              | |                               ##
##              |_|                               ##
##                                                ##
##  Get documentation at docs.liquibase.com       ##
##  Get certified courses at learn.liquibase.com  ##
##                                                ##
####################################################
Starting Liquibase at 20:39:51 (version 4.27.0 #1525 built at 2024-03-25 17:08+0000)
[2024-09-09 20:39:51] INFO [liquibase.ui] ####################################################
##   _     _             _ _                      ##
##  | |   (_)           (_) |                     ##
##  | |    _  __ _ _   _ _| |__   __ _ ___  ___   ##
##  | |   | |/ _` | | | | | '_ \ / _` / __|/ _ \  ##
##  | |___| | (_| | |_| | | |_) | (_| \__ \  __/  ##
##  \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___|  ##
##              | |                               ##
##              |_|                               ##
##                                                ##
##  Get documentation at docs.liquibase.com       ##
##  Get certified courses at learn.liquibase.com  ##
##                                                ##
####################################################
Starting Liquibase at 20:39:51 (version 4.27.0 #1525 built at 2024-03-25 17:08+0000)
Liquibase Version: 4.27.0
[2024-09-09 20:39:51] INFO [liquibase.ui] Liquibase Version: 4.27.0
WARNING: License service not loaded, cannot determine Liquibase Pro license status. Please consider re-installing Liquibase to include all dependencies. Continuing operation without Pro license.
[2024-09-09 20:39:51] INFO [liquibase.ui] WARNING: License service not loaded, cannot determine Liquibase Pro license status. Please consider re-installing Liquibase to include all dependencies. Continuing operation without Pro license.
[2024-09-09 20:39:51] INFO [liquibase.integration] Starting command execution.
[2024-09-09 20:39:52] INFO [liquibase.command] Logging exception.
ERROR: Exception Details
[2024-09-09 20:39:52] INFO [liquibase.ui] ERROR: Exception Details
ERROR: Exception Primary Class:  RuntimeException
[2024-09-09 20:39:52] INFO [liquibase.ui] ERROR: Exception Primary Class:  RuntimeException
ERROR: Exception Primary Reason:  Driver class was not specified and could not be determined from the url (hibernate:spring:br.subscribe.domain?dialect=org.hibernate.dialect.H2Dialect)
[2024-09-09 20:39:52] INFO [liquibase.ui] ERROR: Exception Primary Reason:  Driver class was not specified and could not be determined from the url (hibernate:spring:br.subscribe.domain?dialect=org.hibernate.dialect.H2Dialect)
ERROR: Exception Primary Source:  4.27.0
[2024-09-09 20:39:52] INFO [liquibase.ui] ERROR: Exception Primary Source:  4.27.0
[2024-09-09 20:39:52] INFO [liquibase.command] Command execution complete
[2024-09-09 20:39:52] SEVERE [liquibase.integration] Driver class was not specified and could not be determined from the url (hibernate:spring:br.subscribe.domain?dialect=org.hibernate.dialect.H2Dialect)
liquibase.exception.CommandExecutionException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: java.lang.RuntimeException: Driver class was not specified and could not be determined from the url (hibernate:spring:br.subscribe.domain?dialect=org.hibernate.dialect.H2Dialect)
        at liquibase.command.CommandScope.execute(CommandScope.java:257)
        at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:55)
        at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:24)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
        at picocli.CommandLine.access$1300(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
        at picocli.CommandLine.execute(CommandLine.java:2078)
        at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$2(LiquibaseCommandLine.java:395)
        at liquibase.Scope.child(Scope.java:199)
        at liquibase.Scope.child(Scope.java:175)
        at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$3(LiquibaseCommandLine.java:370)
        at liquibase.Scope.child(Scope.java:199)
        at liquibase.Scope.child(Scope.java:175)
        at liquibase.integration.commandline.LiquibaseCommandLine.execute(LiquibaseCommandLine.java:367)
        at liquibase.integration.commandline.LiquibaseCommandLine.main(LiquibaseCommandLine.java:104)
Caused by: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: java.lang.RuntimeException: Driver class was not specified and could not be determined from the url (hibernate:spring:br.subscribe.domain?dialect=org.hibernate.dialect.H2Dialect)
        at liquibase.command.core.helpers.AbstractDatabaseConnectionCommandStep.createDatabaseObject(AbstractDatabaseConnectionCommandStep.java:105)
        at liquibase.command.core.helpers.ReferenceDbUrlConnectionCommandStep.obtainDatabase(ReferenceDbUrlConnectionCommandStep.java:89)
        at liquibase.command.core.helpers.ReferenceDbUrlConnectionCommandStep.run(ReferenceDbUrlConnectionCommandStep.java:70)
        at liquibase.command.CommandScope.execute(CommandScope.java:219)
        ... 17 more
Caused by: liquibase.exception.DatabaseException: java.lang.RuntimeException: Driver class was not specified and could not be determined from the url (hibernate:spring:br.subscribe.domain?dialect=org.hibernate.dialect.H2Dialect)
        at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:241)
        at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:188)
        at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:153)
        at liquibase.command.core.helpers.AbstractDatabaseConnectionCommandStep.createDatabaseObject(AbstractDatabaseConnectionCommandStep.java:73)
        ... 20 more
Caused by: java.lang.RuntimeException: Driver class was not specified and could not be determined from the url (hibernate:spring:br.subscribe.domain?dialect=org.hibernate.dialect.H2Dialect)
        at liquibase.database.DatabaseFactory.findDriverClass(DatabaseFactory.java:291)
        at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:224)
        ... 23 more


Unexpected error running Liquibase: Driver class was not specified and could not be determined from the url (hibernate:spring:br.subscribe.domain?dialect=org.hibernate.dialect.H2Dialect)

liquibase.exception.CommandExecutionException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: java.lang.RuntimeException: Driver class was not specified and could not be determined from the url (hibernate:spring:br.subscribe.domain?dialect=org.hibernate.dialect.H2Dialect)
        at liquibase.command.CommandScope.execute(CommandScope.java:257)
        at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:55)
        at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:24)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
        at picocli.CommandLine.access$1300(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
        at picocli.CommandLine.execute(CommandLine.java:2078)
        at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$2(LiquibaseCommandLine.java:395)
        at liquibase.Scope.child(Scope.java:199)
        at liquibase.Scope.child(Scope.java:175)
        at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$3(LiquibaseCommandLine.java:370)
        at liquibase.Scope.child(Scope.java:199)
        at liquibase.Scope.child(Scope.java:175)
        at liquibase.integration.commandline.LiquibaseCommandLine.execute(LiquibaseCommandLine.java:367)
        at liquibase.integration.commandline.LiquibaseCommandLine.main(LiquibaseCommandLine.java:104)
Caused by: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: java.lang.RuntimeException: Driver class was not specified and could not be determined from the url (hibernate:spring:br.subscribe.domain?dialect=org.hibernate.dialect.H2Dialect)
        at liquibase.command.core.helpers.AbstractDatabaseConnectionCommandStep.createDatabaseObject(AbstractDatabaseConnectionCommandStep.java:105)
        at liquibase.command.core.helpers.ReferenceDbUrlConnectionCommandStep.obtainDatabase(ReferenceDbUrlConnectionCommandStep.java:89)
        at liquibase.command.core.helpers.ReferenceDbUrlConnectionCommandStep.run(ReferenceDbUrlConnectionCommandStep.java:70)
        at liquibase.command.CommandScope.execute(CommandScope.java:219)
        ... 17 more
Caused by: liquibase.exception.DatabaseException: java.lang.RuntimeException: Driver class was not specified and could not be determined from the url (hibernate:spring:br.subscribe.domain?dialect=org.hibernate.dialect.H2Dialect)
        at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:241)
        at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:188)
        at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:153)
        at liquibase.command.core.helpers.AbstractDatabaseConnectionCommandStep.createDatabaseObject(AbstractDatabaseConnectionCommandStep.java:73)
        ... 20 more
Caused by: java.lang.RuntimeException: Driver class was not specified and could not be determined from the url (hibernate:spring:br.subscribe.domain?dialect=org.hibernate.dialect.H2Dialect)
        at liquibase.database.DatabaseFactory.findDriverClass(DatabaseFactory.java:291)
        at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:224)
        ... 23 more

> Task :diffChangelog FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':diffChangelog'.
> Process 'command 'C:\Program Files\Java\jdk-17.0.1\bin\java.exe'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 25s
1 actionable task: 1 executed

@marques-work
Copy link
Author

@daniloalexandre never seen that happen before. I wonder if the problem is really the connection URL? Have you just tried a standard H2 JDBC url, like jdbc:h2:path/to/h2db? I wonder if the results are different. The error message seems like it's attempting to determine the driver class from the URL, despite you providing driver as a param. Maybe worth trying at least to see if your results are different.

@stevesaliman
Copy link
Collaborator

If you run gradle with --debug, and the plugin is running liquibase with all the right arguments, as described in a previous comment, then the issue probably lies in Liquibase itself, and not the plugin. The fact that "the liquibase parameters are found" is a good sign :-)

Are you specifying a driver class, or just defining a URL? Is there a "--driver=some.class" being passed to Liquibase itself?

@daniloalexandre
Copy link

Yes for all quetions. =)

2024-09-10T10:29:40.472-0300 [DEBUG] [org.gradle.api.Project] liquibase-plugin: Running 'liquibase --driver=org.h2.Driver --log-level=info diff-changelog --changelog-file=${buildDir}/20240910102936_changelog.xml --password=  --reference-url=hibernate:spring:br.subscribe.domain?dialect=org.hibernate.dialect.H2Dialect --url=jdbc:h2:file:./h2db/subscribe_db;DB_CLOSE_DELAY=-1;AUTO_SERVER=true;MODE=MYSQL; --username=sa'

@stevesaliman
Copy link
Collaborator

@daniloalexandre, I'm not sure what is happening in your case, but the debug output looks like the plugin is calling Liquibase correctly, so I don't think this is a pugin issue.

Since you and others are reporting that Liquibse is being called correctly now, I've released 3.0.1, and I'm closing this issue.

stevesaliman added a commit to stevesaliman/generator-jhipster that referenced this issue Sep 15, 2024
The 3.0.0 release had a classpath related bug that caused liquibase to fail in most cases.  This was fixed in version 3.0.1.  See liquibase/liquibase-gradle-plugin#151 and liquibase/liquibase-gradle-plugin#154
stevesaliman added a commit to stevesaliman/generator-jhipster that referenced this issue Sep 15, 2024
The 3.0.0 release had a classpath related bug that caused liquibase to fail in most cases.  This was fixed in version 3.0.1.  See liquibase/liquibase-gradle-plugin#151 and liquibase/liquibase-gradle-plugin#154
@awhitmer-df
Copy link

awhitmer-df commented Sep 17, 2024

Based on some of the comments from @marques-work and @daniloalexandre, and my own experiences, I think the 3.0.1 fix works most of the time, but not always for some reason.

It will work probably 80-90% of the time, then periodically fail out with the Invalid argument '--changelog-file': missing required argument error that we were seeing before. When it gets in this state it will tend to continue failing. Passing in the --scan flag seems to usually succeed, and then allow subsequent runs to succeed.

I keyed in on one of @stevesaliman's comments above about what is output by the --debug flag. Below I'll post my output. Both were just running liquibase update. The second one that succeeded was using the --scan flag as well.

We are using Groovy for our build.gradle file and not using Kotlin at all in the project. I'm noting this because the others seemed to be using Kotlin Gradle files. If there's any additional information I can provide please let me know.

A co-worker was also able to replicate the behavior on their machine after some tries.

# WHEN NOT WORKING
2024-09-17T09:32:14.223-0400 [QUIET] [system.out] liquibase-plugin: Running the 'main' activity...
2024-09-17T09:32:14.223-0400 [DEBUG] [org.gradle.api.Project] liquibase-plugin: The liquibase.integration.commandline.LiquibaseCommandLine class will be used to run Liquibase
2024-09-17T09:32:14.223-0400 [DEBUG] [org.gradle.api.Project] liquibase-plugin: Liquibase will be run with the following jvmArgs: []
2024-09-17T09:32:14.223-0400 [DEBUG] [org.gradle.api.Project] liquibase-plugin: Running 'liquibase update'

# WHEN WORKING
2024-09-17T09:42:39.742-0400 [QUIET] [system.out] liquibase-plugin: Running the 'main' activity...
2024-09-17T09:42:39.742-0400 [DEBUG] [org.gradle.api.Project] liquibase-plugin: The liquibase.integration.commandline.LiquibaseCommandLine class will be used to run Liquibase
2024-09-17T09:42:39.742-0400 [DEBUG] [org.gradle.api.Project] liquibase-plugin: Liquibase will be run with the following jvmArgs: []
2024-09-17T09:42:39.743-0400 [DEBUG] [org.gradle.api.Project] liquibase-plugin: Running 'liquibase --classpath=myLocalPath --log-level=info update --changelog-file=db/changelog-master.yml --password=12345 --url=jdbc:mysql://localhost:3306/test?autoReconnect=true&zeroDateTimeBehavior=convertToNull&useSSL=false --username=1234'

@jandrade1
Copy link

jandrade1 commented Sep 25, 2024

As @awhitmer-df mentioned, it's also happening for me sporadically with 3.0.1. What I've found though is that the moment you stop the gradle daemon (./gradlew --stop), the update task works again (until it doesn't). We're using Groovy as well.

@rafaeljpc
Copy link

I'm doing some tests here too. I found that in debug mode it works like a charm, but it doesn`t work when running normally. I think it looks like having something with threads and memory sharing. The args are not being passed to the liquibase command, but when I debug it to see whats is happening, it works.

@marques-work
Copy link
Author

marques-work commented Oct 1, 2024

@stevesaliman as others have reported, I do see this on occasion, but it seems to go away after killing daemons and retrying. I wonder if multiple gradle daemons are present if only one of them works because of some state that is set on initial run. Like @rafaeljpc suggested, this intermittent behavior looks consistent with threads and memory issues. Luckily for my team, the gradle plugin is a localdev convenience and not critical for deployment, but others may be blocked by this.

That said, maybe a proposed workaround is to use --no-daemon when running this gradle task.

To others here: as this issue is closed (and I'm not able to reopen it), you might get more traction if you open a new issue and report these intermittent failures.

@T00fy
Copy link

T00fy commented Oct 7, 2024

Created #157

@daniloalexandre
Copy link

daniloalexandre commented Oct 12, 2024

Hi, @stevesaliman and @marques-work . Sorry for later answer.

I was working on several changes in project and now I'm back for this issue.

The project currently uses Postgres datasource connection and I changed my liquibase activities as follow:

liquibase {
    activities {
        main {
            driver 'org.postgresql.Driver'
            url 'jdbc:postgresql://localhost:5432/subscribe_db'
            username 'postgres'
            password 'postgres'
            defaultSchemaName 'subscribe'
            changelogFile 'src/main/resources/db/changelog/master.xml'
            logLevel 'info'
        }
        
        diffLog {
            driver 'org.postgresql.Driver'
            url 'jdbc:postgresql://localhost:5432/subscribe_db'
            username 'postgres'
            password 'postgres'
            defaultSchemaName 'subscribe'
            schemas 'subscribe'
            changelogFile project.ext.diffChangelogFile
            referenceUrl 'hibernate:spring:br.subscribe.domain?dialect=org.hibernate.dialect.PostgreSQLDialect'
            referenceDriver 'liquibase.ext.hibernate.database.connection.HibernateDriver'
            referenceDefaultSchemaName 'subscribe'
            referenceSchemas 'subscribe'
            logLevel 'info'
        }

    }

    runList = project.ext.runList
}

I noticed that 'referenceDriver' is needed to avoid the error:

Caused by: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: java.lang.RuntimeException: Driver class was not specified and could not be determined from the url (hibernate:spring:br.subscribe.domain?dialect=org.hibernate.dialect.PostgreSQL)

After that, when I'm using--no-daemon, the liquibase task "update" works properly.

But, when I try to execute the task 'diffChangeLog':

gradlew diffChangelog -PrunList=diffLog --no-daemon

the follow error occurs:

WARNING: License service not loaded, cannot determine Liquibase Pro license status. Please consider re-installing Liquibase to include all dependencies. Continuing operation without Pro license.
[2024-10-12 13:38:31] INFO [liquibase.ui] WARNING: License service not loaded, cannot determine Liquibase Pro license status. Please consider re-installing Liquibase to include all dependencies. Continuing operation without Pro license.
[2024-10-12 13:38:31] INFO [liquibase.integration] Starting command execution.
[2024-10-12 13:38:32] WARNING [liquibase.database] Unknown database: Hibernate
[2024-10-12 13:38:32] WARNING [liquibase.command] Ignoring the global liquibase.driver value in favor of the command value.
[2024-10-12 13:38:32] INFO [liquibase.database] Error getting default schema
java.lang.NullPointerException: Cannot invoke "java.sql.CallableStatement.executeQuery()" because "cs" is null
        at liquibase.executor.jvm.JdbcExecutor$QueryCallableStatementCallback.doInCallableStatement(JdbcExecutor.java:585)
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:136)
        at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:224)
        at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:235)
        at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:243)
        at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:258)
        at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:253)
        at liquibase.database.AbstractJdbcDatabase.getConnectionSchemaName(AbstractJdbcDatabase.java:354)
        at liquibase.database.AbstractJdbcDatabase.getDefaultSchemaName(AbstractJdbcDatabase.java:311)
        at liquibase.CatalogAndSchema.standardize(CatalogAndSchema.java:87)
        at liquibase.CatalogAndSchema.customize(CatalogAndSchema.java:140)
        at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:180)
        at liquibase.command.core.DiffCommandStep.generateDatabaseShapshot(DiffCommandStep.java:205)
        at liquibase.command.core.DiffCommandStep.createReferenceSnapshot(DiffCommandStep.java:192)
        at liquibase.command.core.DiffCommandStep.createDiffResult(DiffCommandStep.java:113)
        at liquibase.command.core.DiffCommandStep.run(DiffCommandStep.java:89)
        at liquibase.command.CommandScope.execute(CommandScope.java:219)
        at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:55)
        at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:24)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
        at picocli.CommandLine.access$1300(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
        at picocli.CommandLine.execute(CommandLine.java:2078)
        at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$2(LiquibaseCommandLine.java:395)
        at liquibase.Scope.child(Scope.java:199)
        at liquibase.Scope.child(Scope.java:175)
        at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$3(LiquibaseCommandLine.java:370)
        at liquibase.Scope.child(Scope.java:199)
        at liquibase.Scope.child(Scope.java:175)
        at liquibase.integration.commandline.LiquibaseCommandLine.execute(LiquibaseCommandLine.java:367)
        at liquibase.integration.commandline.LiquibaseCommandLine.main(LiquibaseCommandLine.java:104)

[2024-10-12 13:38:32] INFO [liquibase.database] Error getting default schema
java.lang.NullPointerException: Cannot invoke "java.sql.CallableStatement.executeQuery()" because "cs" is null
        at liquibase.executor.jvm.JdbcExecutor$QueryCallableStatementCallback.doInCallableStatement(JdbcExecutor.java:585)
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:136)
        at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:224)
        at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:235)
        at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:243)
        at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:258)
        at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:253)
        at liquibase.database.AbstractJdbcDatabase.getConnectionSchemaName(AbstractJdbcDatabase.java:354)
        at liquibase.database.AbstractJdbcDatabase.getDefaultSchemaName(AbstractJdbcDatabase.java:311)
        at liquibase.CatalogAndSchema.standardize(CatalogAndSchema.java:100)
        at liquibase.CatalogAndSchema.customize(CatalogAndSchema.java:140)
        at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:180)
        at liquibase.command.core.DiffCommandStep.generateDatabaseShapshot(DiffCommandStep.java:205)
        at liquibase.command.core.DiffCommandStep.createReferenceSnapshot(DiffCommandStep.java:192)
        at liquibase.command.core.DiffCommandStep.createDiffResult(DiffCommandStep.java:113)
        at liquibase.command.core.DiffCommandStep.run(DiffCommandStep.java:89)
        at liquibase.command.CommandScope.execute(CommandScope.java:219)
        at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:55)
        at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:24)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
        at picocli.CommandLine.access$1300(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
        at picocli.CommandLine.execute(CommandLine.java:2078)
        at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$2(LiquibaseCommandLine.java:395)
        at liquibase.Scope.child(Scope.java:199)
        at liquibase.Scope.child(Scope.java:175)
        at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$3(LiquibaseCommandLine.java:370)
        at liquibase.Scope.child(Scope.java:199)
        at liquibase.Scope.child(Scope.java:175)
        at liquibase.integration.commandline.LiquibaseCommandLine.execute(LiquibaseCommandLine.java:367)
        at liquibase.integration.commandline.LiquibaseCommandLine.main(LiquibaseCommandLine.java:104)

[2024-10-12 13:38:32] INFO [liquibase.snapshot] Creating snapshot
[2024-10-12 13:38:32] WARNING [liquibase.snapshot] Unable to retrieve the list of catalog names from the database metadata
[2024-10-12 13:38:33] INFO [liquibase.command] Logging exception.
ERROR: Exception Details
[2024-10-12 13:38:33] INFO [liquibase.ui] ERROR: Exception Details
ERROR: Exception Primary Class:  NullPointerException
[2024-10-12 13:38:33] INFO [liquibase.ui] ERROR: Exception Primary Class:  NullPointerException
ERROR: Exception Primary Reason:  Cannot invoke "java.sql.ResultSet.next()" because "schemas" is null
[2024-10-12 13:38:33] INFO [liquibase.ui] ERROR: Exception Primary Reason:  Cannot invoke "java.sql.ResultSet.next()" because "schemas" is null
ERROR: Exception Primary Source:  PostgreSQL 15.5
[2024-10-12 13:38:33] INFO [liquibase.ui] ERROR: Exception Primary Source:  PostgreSQL 15.5
[2024-10-12 13:38:33] INFO [liquibase.command] Command execution complete
[2024-10-12 13:38:33] SEVERE [liquibase.integration] Cannot invoke "java.sql.ResultSet.next()" because "schemas" is null
liquibase.exception.CommandExecutionException: java.lang.NullPointerException: Cannot invoke "java.sql.ResultSet.next()" because "schemas" is null
        at liquibase.command.CommandScope.execute(CommandScope.java:257)
        at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:55)
        at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:24)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
        at picocli.CommandLine.access$1300(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
        at picocli.CommandLine.execute(CommandLine.java:2078)
        at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$2(LiquibaseCommandLine.java:395)
        at liquibase.Scope.child(Scope.java:199)
        at liquibase.Scope.child(Scope.java:175)
        at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$3(LiquibaseCommandLine.java:370)
        at liquibase.Scope.child(Scope.java:199)
        at liquibase.Scope.child(Scope.java:175)
        at liquibase.integration.commandline.LiquibaseCommandLine.execute(LiquibaseCommandLine.java:367)
        at liquibase.integration.commandline.LiquibaseCommandLine.main(LiquibaseCommandLine.java:104)
Caused by: java.lang.NullPointerException: Cannot invoke "java.sql.ResultSet.next()" because "schemas" is null
        at liquibase.snapshot.jvm.SchemaSnapshotGenerator.getDatabaseSchemaNames(SchemaSnapshotGenerator.java:129)
        at liquibase.snapshot.jvm.SchemaSnapshotGenerator.snapshotObject(SchemaSnapshotGenerator.java:63)
        at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:65)
        at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:49)
        at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:68)
        at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:49)
        at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:68)
        at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:49)
        at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:68)
        at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:49)
        at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:313)
        at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:106)
        at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:59)
        at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:38)
        at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:214)
        at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:187)
        at liquibase.command.core.DiffCommandStep.generateDatabaseShapshot(DiffCommandStep.java:205)
        at liquibase.command.core.DiffCommandStep.createReferenceSnapshot(DiffCommandStep.java:192)
        at liquibase.command.core.DiffCommandStep.createDiffResult(DiffCommandStep.java:113)
        at liquibase.command.core.DiffCommandStep.run(DiffCommandStep.java:89)
        at liquibase.command.CommandScope.execute(CommandScope.java:219)
        ... 17 more


Unexpected error running Liquibase: Cannot invoke "java.sql.ResultSet.next()" because "schemas" is null

As you can see on diffLog activity, I declare the properties 'defaultSchemaName', 'schemas', 'referenceDefaultSchemaName' and 'referenceSchemas'.

What I missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants