When I run below command in liquibase 3.9.0 under extracted root folder I am getting below error. Please advice
liquibaseextracteddirectory>>java -jar liquibase.jar
Error: Unable to initialize main class liquibase.integration.commandline.Main
Caused by: java.lang.NoClassDefFoundError: ch/qos/logback/core/Context
Starting Liquibase at Wed, 28 Oct 2020 11:30:45 IST (version 3.9.0 #11 built at Thu May 14 04:03:56 UTC 2020)
Liquibase Version: 3.9.0
Liquibase Community 3.9.0 by Datical
Where did the liquibase.jar come from? if you are in the liquibase install directory, why are you running it via âjava -jarâ instead of just calling ./liquibase [command]?
We meant extracted folder as, unzipped folder location of downloaded liquibase-3.9.0.zip. ./liquibase command works fine. We are using java -jar as we want to take db files from particular war file, following below command as per liquibase documentation
Where did you get this command from? I am looking at this documentation:
And classpath is supposed to point to your oracle jdbc jar, not a war file. Liquibase looks for db scripts by looking at the value of changeLogFile, and sometimes, the changeLogFile can include a directory.
So, please:
change your classpath to the full path and filename of your oracle jdbc driver jar.
point liquibase to a changelog via commandline or liquibase.properties file and set the changeLogFile property.
It is in the same link provided, under section Run update pulling changelogs from a .WAR file. Trying that option.
Even if I give only java -jar liquibase.jar it fails with below output. I tried different options like passing -cp with lib folder of liquibase, -classpath of lib folder, even then it fails.
Error: Unable to initialize main class liquibase.integration.commandline.Main
Caused by: java.lang.NoClassDefFoundError: ch/qos/logback/core/Context
I see, and what value do you have for changelogfile? I noticed it is redacted but it should follow reverse domain notation relative to War root like this:
Yes I have given reference path in the war only. It is not going to the stage of taking the change log it fails before that. If I give plain execution of just java -jar liquibase.jar it fails, it seems to be not recognizing the lib folder where liquibase jars are available. I tried giving CP, classpath to the lib folder it still did not recognize, hence need to understand liquibase.jar how it takes other jars in lib folder for liquibase eg.logback-core-1.2.3.jar
liquibaseextracteddirectory>>java -jar liquibase.jar
Error: Unable to initialize main class liquibase.integration.commandline.Main
Caused by: java.lang.NoClassDefFoundError: ch/qos/logback/core/Context
Thanks Ronan for the follow-up, Yes have provided like with reference to the war path. --changeLogFile=WEB-INF/classes/db/migration/dbchangelog.xml
If we give plain execution of just java -jar liquibase.jar it fails,ch/quos/logback is in the logback*.jar that comes as part of liquibase/lib folder, it does not recognize it. I tried giving CP, classpath to the lib folder it did not work.
liquibaseextracteddirectory>>java -jar liquibase.jar
Error: Unable to initialize main class liquibase.integration.commandline.Main
Caused by: java.lang.NoClassDefFoundError: ch/qos/logback/core/Context
I am still not able to understand what you are trying to do. Maybe you can sign up for a Liquibase Pro Trial and that will let you talk to a support person to see what you are doing. The description so far leaves me still wondering where you are running java from and why liquibase is looking in ch/quos/âŚ
I faced the problem - when I tried to run âjava -jar liquibase-core.jarâ I saw following error:
java -jar liquibase-core-4.23.0.jar
Exception in thread âmainâ java.lang.ClassNotFoundException: liquibase.integration.commandline.LiquibaseCommandLine
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at liquibase.integration.commandline.LiquibaseLauncher.main(LiquibaseLauncher.java:105)
Problem was solved when I added CORRECT variable for LIQUIBASE_HOME:
It shouldnât be folder with âliquibase-core.jarâ
but it should be folder that contains following folders structure:
%LIQUIBASE_HOME%\internal\lib\liquibase-core.jar
After I changed this variable, everything started working fine.