4.28.0 error in validate

I am trying to move my liquibase karaf feature to 4.28.0 but it fails during validation, when applying a change list.

See below stack trace.

I think I’m probably missing something in the setup of liquibase…?

All points, hints, tips and clues appreciated! Thanks in advance!

Here is the stack trace of the failure:

liquibase.exception.CommandExecutionException: java.lang.NullPointerException: Cannot invoke "liquibase.changelog.visitor.ValidatingVisitorGenerator.generateValidatingVisitor(java.util.List)" because "generator" is null
	at liquibase.command.CommandScope.execute(CommandScope.java:257) ~[?:?]
	at no.priv.bang.karaf.liquibase.runner.LiquibaseClassPathChangeLogRunner.lambda$applyLiquibaseChangelist$0(LiquibaseClassPathChangeLogRunner.java:56) ~[?:?]
	at liquibase.Scope.child(Scope.java:200) ~[?:?]
	at liquibase.Scope.child(Scope.java:176) ~[?:?]
	at no.priv.bang.karaf.liquibase.runner.LiquibaseClassPathChangeLogRunner.applyLiquibaseChangelist(LiquibaseClassPathChangeLogRunner.java:53) ~[?:?]
	at no.priv.bang.karaf.sample.db.liquibase.test.SampleDbLiquibaseRunner.applyLiquibaseChangelist(SampleDbLiquibaseRunner.java:69) ~[?:?]
	at no.priv.bang.karaf.sample.db.liquibase.test.SampleDbLiquibaseRunner.prepare(SampleDbLiquibaseRunner.java:52) ~[?:?]
	at org.ops4j.pax.jdbc.config.impl.DataSourceRegistration.<init>(DataSourceRegistration.java:88) ~[?:?]
	at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$4(DataSourceConfigManager.java:95) ~[?:?]
	at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper$1.addingService(ServiceTrackerHelper.java:132) ~[?:?]
	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:943) ~[osgi.core-8.0.0.jar:?]
	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:871) ~[osgi.core-8.0.0.jar:?]
	at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[osgi.core-8.0.0.jar:?]
	at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[osgi.core-8.0.0.jar:?]
	at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:903) ~[osgi.core-8.0.0.jar:?]
	at org.apache.felix.framework.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:990) ~[?:?]
	at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:838) ~[?:?]
	at org.apache.felix.framework.EventDispatcher.fireServiceEvent(EventDispatcher.java:545) ~[?:?]
	at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4863) ~[?:?]
	at org.apache.felix.framework.Felix.registerService(Felix.java:3834) ~[?:?]
	at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:328) ~[?:?]
	at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:302) ~[?:?]
	at org.ops4j.pax.jdbc.derby.impl.Activator.start(Activator.java:34) ~[?:?]
	at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:849) ~[?:?]
	at org.apache.felix.framework.Felix.activateBundle(Felix.java:2429) ~[?:?]
	at org.apache.felix.framework.Felix.startBundle(Felix.java:2335) ~[?:?]
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:1006) ~[?:?]
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:992) ~[?:?]
	at org.apache.karaf.features.internal.service.BundleInstallSupportImpl.startBundle(BundleInstallSupportImpl.java:165) ~[?:?]
	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1160) ~[?:?]
	at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:1041) ~[?:?]
	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1069) ~[?:?]
	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:1004) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:840) [?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "liquibase.changelog.visitor.ValidatingVisitorGenerator.generateValidatingVisitor(java.util.List)" because "generator" is null
	at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:375) ~[?:?]
	at liquibase.command.core.helpers.DatabaseChangelogCommandStep.run(DatabaseChangelogCommandStep.java:92) ~[?:?]
	at liquibase.command.CommandScope.execute(CommandScope.java:219) ~[?:?]
	... 36 more

Hi @SteinarBang,

Would you mind sharing some additional details like your changelog (or an example of it)? Maybe your property details, DB you are using, etc? I tried running a validate command using latest Liquibase version and a Postgres DB and it ran successfully.

Thanks,
Daniel.

What’s missing is and for at least one service, similar to what’s fixed here Add missing OSGI settings by filipelautert · Pull Request #5498 · liquibase/liquibase · GitHub

(Note @filipelautert you probably know what this is, since you provided that PR)

At least one that is missing is liquibase.changelog.visitor.ValidatingVisitorGenerator

I tried building a snapshot of liquibase main HEAD with this change in place to test if it was sufficient or if there were more SPI services missing, but “mvn clean install” from the top didn’t work out of the box (I know I have built liquibase snapshots locally earlier on request to test stuff, but I can’t remember what I did).

Here is a patch

diff --git a/liquibase-standard/pom.xml b/liquibase-standard/pom.xml
index 850c06e97..21474f208 100644
--- a/liquibase-standard/pom.xml
+++ b/liquibase-standard/pom.xml
@@ -247,7 +247,8 @@
                             osgi.serviceloader; osgi.serviceloader=liquibase.resource.PathHandler,
                             osgi.serviceloader; osgi.serviceloader=liquibase.report.ShowSummaryGenerator,
                             osgi.serviceloader; osgi.serviceloader=liquibase.parser.LiquibaseSqlParser,
-                            osgi.serviceloader; osgi.serviceloader=liquibase.changeset.ChangeSetService
+                            osgi.serviceloader; osgi.serviceloader=liquibase.changeset.ChangeSetService,
+                            osgi.serviceloader; osgi.serviceloader=liquibase.changelog.visitor.ValidatingVisitorGenerator
                         </Provide-Capability>
                         <Require-Capability>
                             osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)",
@@ -284,7 +285,8 @@
                             osgi.serviceloader; filter:="(osgi.serviceloader=liquibase.resource.PathHandler)"; cardinality:=multiple,
                             osgi.serviceloader; filter:="(osgi.serviceloader=liquibase.report.ShowSummaryGenerator)"; cardinality:=multiple,
                             osgi.serviceloader; filter:="(osgi.serviceloader=liquibase.parser.LiquibaseSqlParser)"; cardinality:=multiple,
-                            osgi.serviceloader; filter:="(osgi.serviceloader=liquibase.changeset.ChangeSetService)"; cardinality:=multiple
+                            osgi.serviceloader; filter:="(osgi.serviceloader=liquibase.changeset.ChangeSetService)"; cardinality:=multiple,
+                            osgi.serviceloader; filter:="(osgi.serviceloader=liquibase.changelog.visitor.ValidatingVisitorGenerator)"; cardinality:=multiple
                         </Require-Capability>
                     </instructions>
                 </configuration>

Opened an issue for this: OSGi header missing for ValidatingVisitorGenerator · Issue #6040 · liquibase/liquibase · GitHub

Cool, thank you for that! Are you keen on submitting a PR for it? We would be happy to review it.

Thanks,
Daniel.

Yeah sure, but that would have to be submitted blindly since I’m unable to build liquibase locally.

(and I would have liked to try it out before submitting a PR to see if it is enough or if there are more services missing)

I get the following compilation errors on “mvn clean install” on the top of liquibase. OpenJDK Java 17 on debian 12.5 “bookworm”:

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/sb/workspaces/liquibase/liquibase/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/AbstractLiquibaseMojo.java:[55,1] cannot find symbol
  symbol:   static REGISTERED_VALUE_PROVIDERS_KEY
  location: class liquibase.configuration.LiquibaseConfiguration
[ERROR] /home/sb/workspaces/liquibase/liquibase/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/AbstractLiquibaseMojo.java:[800,61] cannot find symbol
  symbol:   variable LOG_FORMAT
  location: class liquibase.integration.commandline.LiquibaseCommandLineConfiguration
[ERROR] /home/sb/workspaces/liquibase/liquibase/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/AbstractLiquibaseMojo.java:[801,28] cannot find symbol
  symbol:   variable REGISTERED_VALUE_PROVIDERS_KEY
  location: class org.liquibase.maven.plugins.AbstractLiquibaseMojo
[ERROR] /home/sb/workspaces/liquibase/liquibase/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/AbstractLiquibaseMojo.java:[807,31] cannot find symbol
  symbol:   method setFormatterOnHandler(liquibase.logging.LogService,java.util.logging.Handler)
  location: class liquibase.logging.core.JavaLogService
[ERROR] /home/sb/workspaces/liquibase/liquibase/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/AbstractLiquibaseMojo.java:[857,43] cannot find symbol
  symbol:   variable mavenConfigurationProperties
  location: class liquibase.Scope.Attr
[ERROR] /home/sb/workspaces/liquibase/liquibase/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/AbstractLiquibaseMojo.java:[1151,65] cannot find symbol
  symbol:   method getExisting(java.lang.String)
  location: interface liquibase.resource.ResourceAccessor
[ERROR] /home/sb/workspaces/liquibase/liquibase/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/AbstractLiquibaseMojo.java:[1344,101] incompatible types: java.lang.String cannot be converted to liquibase.configuration.ConfiguredValue
[ERROR] /home/sb/workspaces/liquibase/liquibase/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/AbstractLiquibaseMojo.java:[1436,185] incompatible types: java.lang.String cannot be converted to liquibase.configuration.ConfiguredValue
[ERROR] /home/sb/workspaces/liquibase/liquibase/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/AbstractLiquibaseUpdateMojo.java:[74,14] cannot find symbol
  symbol:   method setShowSummary(liquibase.UpdateSummaryEnum)
  location: variable liquibase of type liquibase.Liquibase
[ERROR] /home/sb/workspaces/liquibase/liquibase/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/AbstractLiquibaseUpdateMojo.java:[75,14] cannot find symbol
  symbol:   method setShowSummaryOutput(liquibase.UpdateSummaryOutputEnum)
  location: variable liquibase of type liquibase.Liquibase
[ERROR] /home/sb/workspaces/liquibase/liquibase/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/LiquibaseConnectMojo.java:[23,21] cannot find symbol
  symbol:   method provideDependency(java.lang.Class<liquibase.database.Database>,liquibase.database.Database)
  location: variable connectCommand of type liquibase.command.CommandScope
[ERROR] /home/sb/workspaces/liquibase/liquibase/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/LiquibaseDatabaseDiff.java:[290,42] cannot find symbol
  symbol:   method setReplaceIfExistsSet(boolean)
  location: variable diffOutputControl of type liquibase.diff.output.DiffOutputControl
[ERROR] /home/sb/workspaces/liquibase/liquibase/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/LiquibaseDatabaseDiff.java:[292,37] no suitable method found for doDiffToChangeLog(java.lang.String,liquibase.database.Database,liquibase.database.Database,java.lang.String,liquibase.diff.output.DiffOutputControl,liquibase.diff.output.ObjectChangeFilter,java.lang.String,liquibase.diff.compare.CompareControl.SchemaComparison[],java.lang.String,java.lang.String)
    method liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(java.lang.String,liquibase.database.Database,liquibase.database.Database,liquibase.diff.output.DiffOutputControl,liquibase.diff.output.ObjectChangeFilter,java.lang.String) is not applicable
      (actual and formal argument lists differ in length)
    method liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(java.lang.String,liquibase.database.Database,liquibase.database.Database,liquibase.diff.output.DiffOutputControl,liquibase.diff.output.ObjectChangeFilter,java.lang.String,liquibase.diff.compare.CompareControl.SchemaComparison[]) is not applicable
      (actual and formal argument lists differ in length)
[ERROR] /home/sb/workspaces/liquibase/liquibase/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/LiquibaseDatabaseDiff.java:[304,66] cannot find symbol
  symbol:   variable FORMAT_ARG
  location: class liquibase.command.core.DiffCommandStep
[ERROR] /home/sb/workspaces/liquibase/liquibase/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/LiquibaseDatabaseDiff.java:[312,112] cannot find symbol
  symbol:   method parseSnapshotTypes(java.lang.String)
  location: class liquibase.command.core.DiffCommandStep
[ERROR] /home/sb/workspaces/liquibase/liquibase/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/LiquibaseDropAll.java:[46,22] method dropAll in class liquibase.Liquibase cannot be applied to given types;
  required: liquibase.CatalogAndSchema[]
  found:    java.lang.Boolean,liquibase.CatalogAndSchema[]
  reason: varargs mismatch; java.lang.Boolean cannot be converted to liquibase.CatalogAndSchema
[ERROR] /home/sb/workspaces/liquibase/liquibase/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/LiquibaseDropAll.java:[48,22] method dropAll in class liquibase.Liquibase cannot be applied to given types;
  required: liquibase.CatalogAndSchema[]
  found:    java.lang.Boolean
  reason: varargs mismatch; java.lang.Boolean cannot be converted to liquibase.CatalogAndSchema
[ERROR] /home/sb/workspaces/liquibase/liquibase/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/LiquibaseGenerateChangeLogMojo.java:[169,34] cannot find symbol
  symbol:   method setReplaceIfExistsSet(boolean)
  location: variable diffOutputControl of type liquibase.diff.output.DiffOutputControl
[ERROR] /home/sb/workspaces/liquibase/liquibase/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/LiquibaseGenerateChangeLogMojo.java:[181,33] no suitable method found for doGenerateChangeLog(java.lang.String,liquibase.database.Database,liquibase.CatalogAndSchema[],java.lang.String,java.lang.String,java.lang.String,java.lang.String,liquibase.diff.output.DiffOutputControl,boolean,java.lang.String,java.lang.String)
    method liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog(java.lang.String,liquibase.database.Database,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,liquibase.diff.output.DiffOutputControl) is not applicable
      (actual and formal argument lists differ in length)
    method liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog(java.lang.String,liquibase.database.Database,liquibase.CatalogAndSchema[],java.lang.String,java.lang.String,java.lang.String,java.lang.String,liquibase.diff.output.DiffOutputControl) is not applicable
      (actual and formal argument lists differ in length)

So you fetched latest changes and then when running mvn clean install you are seeing this build issue, is that correct? Have you tried restarting your IDE by clearing cache I’m wondering whether there could be something cached from your build to be displaying that error, because I’ve been running the same thing and I’m not seeing this error.

Not using an IDE.

This is “mvn clean install” from the command line, after doing “git pull -p” on main.

I figured my Java version might be the issue…? (but Java 17 is all I’ve got…)

Or… is there some code generating step that has to be run before “install”?

Tried again now and now it worked.

No local changes but git reported liquibase-core/src as an untracked directory. Were no .java files in there, though. Just some sql files in src/test/resources. I did “rm -rf liquibase-core/src” anyway.

But I noticed that mvn downloaded a lot of files it didn’t download yesterday, so maybe it was new snapshots or something that an automated build has installed (or something…?)

But anyway if I’m able to try out the PR changes and verify that they work I can provide a PR! :+1: :smiley:

PR here: Add osgi.serverloader manifest header entries for liquibase.changelog.visitor.ValidatingVisitorGenerator #6040 fix by steinarb · Pull Request #6045 · liquibase/liquibase · GitHub

Comment added to the issue: OSGi header missing for ValidatingVisitorGenerator · Issue #6040 · liquibase/liquibase · GitHub