添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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

Please find the output of the version command

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

Thanks for your reply.

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

java -jar liquibase.jar
–driver=oracle.jdbc.OracleDriver
–classpath=website.war
–changeLogFile=xxxxxl
–url=jdbc:oracle:xxx
–username=xxx
–password=xxx
update

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.
  • After that, what error do you see?

    Thanks,

    Ronak

    Thanks for the reply.

    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:

    --changeLogFile=com/example/db.changelog.xml
                  

    Thanks for the reply.

    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

    Hi @selvakumarm,

    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/…

    Support I am sure can get you sorted out quickly,

    Ronak

    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.