# Error while running from command line java -jar liquibase.jar

**URL:** https://forum.liquibase.org/t/error-while-running-from-command-line-java-jar-liquibase-jar/4755
**Category:** General Discussion
**Created:** [October 27, 2020, 12:31pm UTC](https://forum.liquibase.org/t/error-while-running-from-command-line-java-jar-liquibase-jar/4755 "2020-10-27T12:31:19Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![selvakumarm](https://avatars.discourse-cdn.com/v4/letter/s/b38774/32.png) [@selvakumarm](https://forum.liquibase.org/u/selvakumarm)
#### Post date: [October 27, 2020, 12:31pm UTC](https://forum.liquibase.org/t/error-while-running-from-command-line-java-jar-liquibase-jar/4755/1 "2020-10-27T12:31:19Z")

</div>

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

---

<div class="post-metadata">

### Author: ![hope99](https://avatars.discourse-cdn.com/v4/letter/h/439d5e/32.png) [@hope99](https://forum.liquibase.org/u/hope99)
#### Post date: [October 27, 2020, 8:05pm UTC](https://forum.liquibase.org/t/error-while-running-from-command-line-java-jar-liquibase-jar/4755/2 "2020-10-27T20:05:55Z")

</div>

Hi  
Can you run liquibase --version command and see if gives you output as expected?

---

<div class="post-metadata">

### Author: ![selvakumarm](https://avatars.discourse-cdn.com/v4/letter/s/b38774/32.png) [@selvakumarm](https://forum.liquibase.org/u/selvakumarm)
#### Post date: [October 28, 2020, 6:01am UTC](https://forum.liquibase.org/t/error-while-running-from-command-line-java-jar-liquibase-jar/4755/3 "2020-10-28T06:01:45Z")

</div>

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

---

<div class="post-metadata">

### Author: ![hope99](https://avatars.discourse-cdn.com/v4/letter/h/439d5e/32.png) [@hope99](https://forum.liquibase.org/u/hope99)
#### Post date: [October 28, 2020, 8:14pm UTC](https://forum.liquibase.org/t/error-while-running-from-command-line-java-jar-liquibase-jar/4755/4 "2020-10-28T20:14:19Z")

</div>

Thats good. Can you run a command like “history” or “updateSQL”. I have not seen this error and I will wait for other mods to respond as well.

---

<div class="post-metadata">

### Author: ![selvakumarm](https://avatars.discourse-cdn.com/v4/letter/s/b38774/32.png) [@selvakumarm](https://forum.liquibase.org/u/selvakumarm)
#### Post date: [October 29, 2020, 10:58am UTC](https://forum.liquibase.org/t/error-while-running-from-command-line-java-jar-liquibase-jar/4755/5 "2020-10-29T10:58:33Z")

</div>

Via liquibase.bat run commands update, updatesql works fine. But when I run via java -jar only it fails

---

<div class="post-metadata">

### Author: ![ronak](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/ronak/32/221_2.png) [@ronak](https://forum.liquibase.org/u/ronak)
#### Post date: [October 29, 2020, 6:48pm UTC](https://forum.liquibase.org/t/error-while-running-from-command-line-java-jar-liquibase-jar/4755/6 "2020-10-29T18:48:16Z")

</div>

Could we see the complete error output?

> [@selvakumarm](#):
>
> extracted root folder

What does that mean ^

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]?

---

<div class="post-metadata">

### Author: ![selvakumarm](https://avatars.discourse-cdn.com/v4/letter/s/b38774/32.png) [@selvakumarm](https://forum.liquibase.org/u/selvakumarm)
#### Post date: [October 30, 2020, 5:00am UTC](https://forum.liquibase.org/t/error-while-running-from-command-line-java-jar-liquibase-jar/4755/7 "2020-10-30T05:00:29Z")

</div>

Hi

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

---

<div class="post-metadata">

### Author: ![ronak](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/ronak/32/221_2.png) [@ronak](https://forum.liquibase.org/u/ronak)
#### Post date: [November 2, 2020, 10:37pm UTC](https://forum.liquibase.org/t/error-while-running-from-command-line-java-jar-liquibase-jar/4755/8 "2020-11-02T22:37:58Z")

</div>

> [@selvakumarm](#):
>
> java -jar liquibase.jar  
> –driver=oracle.jdbc.OracleDriver  
> –classpath=website.war  
> –changeLogFile=xxxxxl  
> –url=jdbc:oracle:xxx  
> –username=xxx  
> –password=xxx  
> update

Where did you get this command from? I am looking at this documentation:

> **[Working with Command Parameters](https://docs.liquibase.com/parameters/working-with-command-parameters.html)**
>
> This page explains how to run liquibase from the command line. You can also get specific information about the liquibase.properties files.

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](https://docs.liquibase.com/concepts/advanced/includeall.html).

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

---

<div class="post-metadata">

### Author: ![selvakumarm](https://avatars.discourse-cdn.com/v4/letter/s/b38774/32.png) [@selvakumarm](https://forum.liquibase.org/u/selvakumarm)
#### Post date: [November 3, 2020, 7:16am UTC](https://forum.liquibase.org/t/error-while-running-from-command-line-java-jar-liquibase-jar/4755/9 "2020-11-03T07:16:01Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ronak](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/ronak/32/221_2.png) [@ronak](https://forum.liquibase.org/u/ronak)
#### Post date: [November 10, 2020, 9:28pm UTC](https://forum.liquibase.org/t/error-while-running-from-command-line-java-jar-liquibase-jar/4755/10 "2020-11-10T21:28:29Z")

</div>

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:

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

```

---

<div class="post-metadata">

### Author: ![selvakumarm](https://avatars.discourse-cdn.com/v4/letter/s/b38774/32.png) [@selvakumarm](https://forum.liquibase.org/u/selvakumarm)
#### Post date: [November 18, 2020, 5:08pm UTC](https://forum.liquibase.org/t/error-while-running-from-command-line-java-jar-liquibase-jar/4755/11 "2020-11-18T17:08:59Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ronak](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/ronak/32/221_2.png) [@ronak](https://forum.liquibase.org/u/ronak)
#### Post date: [December 7, 2020, 5:55pm UTC](https://forum.liquibase.org/t/error-while-running-from-command-line-java-jar-liquibase-jar/4755/12 "2020-12-07T17:55:04Z")

</div>

Sorry for the delay in response.

> [@selvakumarm](#):
>
> Yes I have given reference path in the war only.

May I see it denoted in your liquibase.properties file? I am not sure what exactly this statement means.

---

<div class="post-metadata">

### Author: ![selvakumarm](https://avatars.discourse-cdn.com/v4/letter/s/b38774/32.png) [@selvakumarm](https://forum.liquibase.org/u/selvakumarm)
#### Post date: [December 11, 2020, 10:16am UTC](https://forum.liquibase.org/t/error-while-running-from-command-line-java-jar-liquibase-jar/4755/13 "2020-12-11T10:16:16Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ronak](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/ronak/32/221_2.png) [@ronak](https://forum.liquibase.org/u/ronak)
#### Post date: [December 16, 2020, 3:18pm UTC](https://forum.liquibase.org/t/error-while-running-from-command-line-java-jar-liquibase-jar/4755/14 "2020-12-16T15:18:11Z")

</div>

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](https://www.liquibase.org/try-liquibase-pro-free) 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

---

<div class="post-metadata">

### Author: ![johnkanesajon](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@johnkanesajon](https://forum.liquibase.org/u/johnkanesajon)
#### Post date: [January 12, 2021, 11:35am UTC](https://forum.liquibase.org/t/error-while-running-from-command-line-java-jar-liquibase-jar/4755/15 "2021-01-12T11:35:42Z")

</div>

Good information thanks for sharing  
[Fieldengineer](https://www.fieldengineer.com)

---

<div class="post-metadata">

### Author: ![Ganeles](https://avatars.discourse-cdn.com/v4/letter/g/d9b06d/32.png) [@Ganeles](https://forum.liquibase.org/u/Ganeles)
#### Post date: [August 1, 2023, 8:47am UTC](https://forum.liquibase.org/t/error-while-running-from-command-line-java-jar-liquibase-jar/4755/16 "2023-08-01T08:47:43Z")

</div>

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.
