Liquibase not starting up

Hello,

When I try to invoke the CLI update command via shell script, Liquibase does not start up.

When I call the exact same command and parameters manually in the terminal, it works. I see the following message outputted to the terminal:

Starting Liquibase at Mon, 27 Apr 2020 11:07:10 PDT

Liquibase: Update has been successful.

Any ideas why the exact same command fails when invoked from shell?

I’ve been stuck on this for a week now, any help would be appreciated.

Thank you.

Hi Jonathan Sebastian,

Sorry you’ve been toiling away at this for a week, let me try and help.  Some questions:

Would you mind sharing the shell script, or the snippet?

Could you show us the output of the script?  Does it error out on the liquibase command?

How are you executing the shell script?  Is it through some automation orchestration (ex. Jenkins) or are you executing the shell script by hand?

Thanks,

Ronak

Hi Ronak,

I’ve tried two approaches now:

First Approach, answering your questions

The shell script is automatically invoked after installation of our product finishes. So a series of scripts that eventually calls my logic to invoke Liquibase.

There is no terminal output. Our product installs successfully but I do not see the databasechangelog table updated.

When I run the command manually in the terminal I don’t see any errors against the liquibase command. Instead I see the successful output I listed above (CLASSPATH="$ROOT"“postgresql-42.2.5.jar”

for FILE in $(ls “$FOLDER”“abc/def”/*);do

$LIQUIBASE_SCRIPT --driver="${POSTGRES_DRIVER}" --classpath="${CLASSPATH}" --url="${POSTGRES_URL}" --changeLogFile="${FILE}" --username=$USERNAME --password=$PASSWORD update

done

Second Approach

I’ve also been trying to call Main directly. I’m trying these invocations:

  1. $JDK8_64_HOME/bin/java -jar $LIQUIBASE_JAR --defaultsFile="$DEFAULTS" update

  2. $JDK8_64_HOME/bin/java -jar -cp “$DEFAULTS” liquibase.integration.commandline.Main -update

But both error with:

Exception in thread “main” java.lang.NoClassDefFoundError: ch/qos/logback/core/filter/Filter

I placed all the jars in a lib folder in the same directory as the as liquibase jar. Is this incorrect?

Hello Jonathan,

If you are working with Jenkins, try using the following example:

Here is a sample shell script example to consider in a Jenkins file using declarative pipeline:

#!/usr/bin/env groovy

pipeline {

agent any

  environment {

   //Here are my environment variables 

  }

  stages {

   stage (‘Building my app’) {

}</div></div>

}

Thanks,

Steve.

Steve,

Thanks for the suggestion. But the nature of my issue is such that it’s best to show what’s going on through a screenshare and call. I need a timeline on when we could set this up as this issue has been stuck for over a week.

I created a trial account for Liquibase PRO as you instructed and sent a support email to lbprosupport@datical.com.

Thank you,

Jonathan

This has finally been resolved.

Big thanks to Steve from Liquibase support (above) for jumping on a call to help debug this.

Seems the main culprits were an outdated Liquibase.jar and an improperly set JAVA_HOME. The issues were linked like this:

I downloaded the latest jar and compared the liquibase script with my own. They were mostly similar but the newer version had additional code near the bottom. What is important is that the newer jar sets the JAVA_PATH environment variable based on your JAVA_HOME.

Bottom line: use the latest liquibase script and ensure your JAVA_HOME is set.

Jonathan