I’ve just started experimenting with Liquibase. With Java 11, it works as expected. With Java 8, I see warning messages like this on the console:
INFO: Cannot load service
java.lang.UnsupportedClassVersionError: com/liquibase/ext/storedlogic/function/change/BigQueryDropFunctionChange has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:370)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at liquibase.servicelocator.StandardServiceLocator.findInstances(StandardServiceLocator.java:24)
at liquibase.plugin.AbstractPluginFactory.findAllInstances(AbstractPluginFactory.java:100)
at liquibase.change.ChangeFactory.getDefinedChanges(ChangeFactory.java:102)
at liquibase.command.core.helpers.AbstractChangelogCommandStep.supportedReplaceIfExistsTypes(AbstractChangelogCommandStep.java:64)
at liquibase.command.core.helpers.AbstractChangelogCommandStep.(AbstractChangelogCommandStep.java:29)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at liquibase.servicelocator.StandardServiceLocator.findInstances(StandardServiceLocator.java:24)
at liquibase.command.CommandFactory.findAllInstances(CommandFactory.java:247)
at liquibase.command.CommandFactory.getCommands(CommandFactory.java:163)
at liquibase.integration.commandline.LiquibaseCommandLine.getCommands(LiquibaseCommandLine.java:1132)
at liquibase.integration.commandline.LiquibaseCommandLine.buildPicoCommandLine(LiquibaseCommandLine.java:211)
at liquibase.integration.commandline.LiquibaseCommandLine.(LiquibaseCommandLine.java:187)
at liquibase.integration.commandline.LiquibaseCommandLine.main(LiquibaseCommandLine.java:95)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at liquibase.integration.commandline.LiquibaseLauncher.main(LiquibaseLauncher.java:116)
Here’s the Java version info:
$ java -version
java version “1.8.0_291”
Java™ SE Runtime Environment (build 1.8.0_291-b10)
Java HotSpot™ 64-Bit Server VM (build 25.291-b10, mixed mode)
This was running on Windows 10.
What I’ve been able to figure out so far is the java.lang.UnsupportedClassVersionError was coming from the Java Virtual Machine (JVM), not the liquibase logging.
An internet search determined what the class file versions 52 and 55 represent:
- Class file version 52: This corresponds to Java SE 8 (JDK 1.8). When you compile Java source code with JDK 8, the resulting class files will have major version number 52. This means that these class files are intended to be run on a JVM that supports Java 8 or later.
- Class file version 55: This corresponds to Java SE 11 (JDK 11). Compiling Java source code with JDK 11 will produce class files with major version number 55, indicating that they require a JVM compatible with Java 11 or later to execute.
My analysis:
It seems that part of what was released in Liquibase 4.29.1 was compiled with Java 11, and so produces warnings when that version is run using the Java 8 runtime.
A possible workaround?
As a workaround, perhaps an older version of Liquibase that doesn’t display these warnings with Java 8 could be used until this gets fixed.
Does anyone know if and where I can find an archive of downloadable older versions of Liquibase online?