Exception in thread "main" java.lang.NoClassDefFoundError:

I had included the self4j-api.1.7.25 as external jar when I had build it but still same error. 

Also tried the following too

D:\Liquibase3.8.0>set path=%path%;D:\Liquibase3.8.0\lib;

java -jar ./liquibase.jar --driver=com.oracle.ojdbc8 --classpath=“C:\Users\A054804.m2\repository\com\oracle\ojdbc8\12.2.0.1\ojdbc8-12.2.0.1.jar;F:\Liquibase\liquibase\target\liquibase-0.0.1-SNAPSHOT.jar”  --changeLogFile=database.changelog-master.xml  --url=“jdbc:oracle:thin:@host:1521:service”    --username=db11  --password=password update

Exception in thread “main” java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory

        at liquibase.logging.core.Slf4JLoggerFactory.getLog(Slf4JLoggerFactory.java:9)

        at liquibase.logging.LogService.getLog(LogService.java:39)

        at liquibase.integration.commandline.Main.(Main.java:62)

Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory

        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

        … 3 more

Rather than calling java directly, it is much easier to use the provided liquibase.bat file that ships with the liquibase zip file. That batch file will automatically build your classpath using the liquibase jar and all the jars that are in the lib directory. The java executable itself does not allow you to add a path to a directory to the classpath, it expects that every entry on the classpath refers to a specific jar file. 

I also suggest that you put the parameters that don’t change very often into a liquibase.properties file in your project directory to save typing an possible errors. 

Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/

One way to see would be to edit the liquibase.bat file. The last line in liquibase.bat looks like this:


                                version to STDOUT

Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/

Let us know if that resolves the issue.

Once again, Steve coming through with the real answers. Thanks, Steve!!!

Roger. Spoke with Steve today and he’s got you covered below. We should always listen to him and not me. 

liquibase   --classpath=“C:\Users\Axxx.m2\repository\com\oracle\ojdbc8\12.2.0.1\ojdbc8-12.2.0.1.jar;D:\Liquibase\liquibase\target\liquibase-0.0.1-SNAPSHOT.jar”     --changeLogFile=database.changelog-master.xml  --url=“jdbc:oracle:thin:@hostname:1521:a043168”    --username=user–password=password update

the above stuff works. 

How do i make it work with java?

java -jar ./liquibase.jar --driver=com.oracle.ojdbc8 --classpath=“C:\Users\A054804.m2\repository\com\oracle\ojdbc8\12.2.0.1\ojdbc8-12.2.0.1.jar;F:\Liquibase\liquibase\target\liquibase-0.0.1-SNAPSHOT.jar”  --changeLogFile=database.changelog-master.xml  --url=“jdbc:oracle:thin:@host:1521:service”    --username=db11  --password=password update

No it didn’t resolve the issue.