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 -Djava.security.auth.login.config=/path/to/jaas.conf -Djava.security.krb5.conf=/path/to/krb5.conf -Djdk.tls.client.protocols=TLSv1.2 -Dhttp.auth.preference=Kerberos -Dsecurity.auth.useSubjectCredsOnly=false liquibase.integration.commandline.Main --defaultsFile=/path/to/liquibase.properties --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 -Djava.security.auth.login.config=/path/to/jaas.conf -Djava.security.krb5.conf=/path/to/krb5.conf

What I’ve tried/verified:

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

2. The maven plugin has the following specified in pom.xml (added via command line for standalone jar approach). 
	jdk.tls.client.protocols=TLSv1.2 
	http.auth.preference=Kerberos	
	security.auth.useSubjectCredsOnly=false

3. I've put the following jars in /path/to/my/project/ (they are the same ones used by maven-plugin).
	liquibase-core-4.3.3.jar 
	postgresql-42.2.19.jar
	snakeyaml-1.19.jar

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).

Thanks,

Ronak

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.

jdbc:postgresql://database.url.goeshere/myschema?myparm1=value1&myparam2=value2&user=myuserid