Liquibase Command works in maven plugin but not jar

I’m having issues with the below liquibase command while connecting to a cockroachDB:

java -cp “/path/to/my/project/*” -Dliquibase.username=me -Djdk.tls.client.protocols=TLSv1.2 -Dhttp.auth.preference=Kerberos -Dsecurity.auth.useSubjectCredsOnly=false liquibase.integration.commandline.Main --defaultsFile=/path/to/ --changeLogFile=/path/to/main-changelog.yaml updateSQL

Unexpected error running Liquibase: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgresql://(cockroachdb-url-goes-here) with driver org.postgresql.Driver. GSS Authentication failed

The unusal part is that the below liquiibase command through the maven plugin works.

mvn liquibase:updateSQL -Dliquibase.changeLogFile=/path/to/main-changelog.yaml -Dliquibase.username=me

What I’ve tried/verified:

1. has the following properties (both commands use properties file):

2. The maven plugin has the following specified in pom.xml (added via command line for standalone jar approach). 

3. I've put the following jars in /path/to/my/project/ (they are the same ones used by maven-plugin).

Has anyone faced this issue? Any general tips for trouble shooting? Why would the plugin work and not the standalone jar?

Hi @jchaplin ,

May we see the complete log (logLevel=debug) from command line and maven? Looking for context on what Liquibase tried to do or not do in opening the connection.

For the commandline, I noticed you are calling updateSQL, were you running it against a database that has had a successful liquibase update? (I know you mentioned maven works, but not sure if the db persists or it is created for the first time fresh before you run the updateSQL).



Hi Ronak,

Thank you for your reply. We’ve resolved this issue. In short, we had to add user as a parameter to the database connection string (see example below).

For some reason this only impacts the standalone jar case and not the maven plugin. For what it’s worth, I’m using version 4.3.3 of the liquibase core jar for standalone case and version 4.3.2 of the maven plugin.