Jmix 2.2 - Liquibase Generation

Since the migration to Jmix 2.2. Not able to start my application due to this error:

liquibase.exception.CommandExecutionException: java.lang.NullPointerException: Cannot invoke “String.matches(String)” because " " is null

Any idea how to fix it?

1 Like
2024-03-07 14:17:29,560 [  52475]   WARN - #com.haulmont.jmixstudio.intellij.runconfiguration.stepbefore.SyncDbBeforeRunProcess - liquibase.exception.CommandExecutionException: java.lang.NullPointerException: Cannot invoke "String.matches(String)" because "<local8>" is null
liquibase.exception.LiquibaseException: liquibase.exception.CommandExecutionException: java.lang.NullPointerException: Cannot invoke "String.matches(String)" because "<local8>" is null
	at com.haulmont.jmixstudio.liquibase.LiquibaseCommandManager.doDiffToChangeLog(LiquibaseCommandManager.kt:313)
	at com.haulmont.jmixstudio.liquibase.LiquibaseCommandManager.generateDiffChangeLog(LiquibaseCommandManager.kt:281)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler$doRun$1$1$1.invoke(LiquibaseIntellijDiffGenerationHandler.kt:110)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler$doRun$1$1$1.invoke(LiquibaseIntellijDiffGenerationHandler.kt:96)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler.use(LiquibaseIntellijDiffGenerationHandler.kt:137)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler.access$use(LiquibaseIntellijDiffGenerationHandler.kt:34)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler$doRun$1$1.invoke(LiquibaseIntellijDiffGenerationHandler.kt:96)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler$doRun$1$1.invoke(LiquibaseIntellijDiffGenerationHandler.kt:95)
	at com.haulmont.jmixstudio.liquibase.LiquibaseCommandManagerKt.runWithPluginClassLoader(LiquibaseCommandManager.kt:528)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler$doRun$1.invoke(LiquibaseIntellijDiffGenerationHandler.kt:95)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler$doRun$1.invoke(LiquibaseIntellijDiffGenerationHandler.kt:94)
	at com.intellij.openapi.application.ActionsKt.runReadAction$lambda$3(actions.kt:31)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:894)
	at com.intellij.openapi.application.ActionsKt.runReadAction(actions.kt:31)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler.doRun(LiquibaseIntellijDiffGenerationHandler.kt:94)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler.run$lambda$0(LiquibaseIntellijDiffGenerationHandler.kt:70)
	at com.intellij.openapi.progress.impl.CoreProgressManager$1.run(CoreProgressManager.java:258)
	at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:434)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:132)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressSynchronously$8(CoreProgressManager.java:518)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$new$0(ProgressRunner.java:84)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:248)
	at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:73)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:192)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:610)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:685)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:641)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:609)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:78)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:179)
	at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:73)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$5(ProgressRunner.java:248)
	at com.intellij.openapi.progress.impl.ProgressRunner$ProgressRunnable.run(ProgressRunner.java:498)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: liquibase.exception.CommandExecutionException: java.lang.NullPointerException: Cannot invoke "String.matches(String)" because "<local8>" is null
	at liquibase.command.CommandScope.execute(CommandScope.java:237)
	at com.haulmont.jmixstudio.liquibase.LiquibaseCommandManager.doDiffToChangeLog(LiquibaseCommandManager.kt:310)
	... 39 more
Caused by: java.lang.NullPointerException: Cannot invoke "String.matches(String)" because "<local8>" is null
	at liquibase.ext.intellij.diff.comparator.IndexComparator.b(IndexComparator.java:141)
	at liquibase.ext.intellij.diff.comparator.IndexComparator.isSameObject(IndexComparator.java:113)
	at liquibase.diff.compare.DatabaseObjectComparatorChain.isSameObject(DatabaseObjectComparatorChain.java:50)
	at liquibase.diff.compare.DatabaseObjectComparatorFactory.isSameObject(DatabaseObjectComparatorFactory.java:151)
	at liquibase.structure.DatabaseObjectCollection.get(DatabaseObjectCollection.java:116)
	at liquibase.snapshot.DatabaseSnapshot.get(DatabaseSnapshot.java:560)
	at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:298)
	at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:435)
	at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:369)
	at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:332)
	at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:435)
	at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:369)
	at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:332)
	at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:435)
	at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:369)
	at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:332)
	at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:456)
	at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:369)
	at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:332)
	at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:456)
	at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:369)
	at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:332)
	at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:435)
	at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:369)
	at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:332)
	at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:456)
	at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:369)
	at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:332)
	at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:456)
	at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:369)
	at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:332)
	at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:456)
	at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:478)
	at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:369)
	at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:332)
	at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:106)
	at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:59)
	at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:34)
	at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:215)
	at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:188)
	at liquibase.command.core.DiffCommandStep.generateDatabaseShapshot(DiffCommandStep.java:205)
	at liquibase.command.core.DiffCommandStep.getTargetSnapshot(DiffCommandStep.java:155)
	at liquibase.command.core.DiffCommandStep.createDiffResult(DiffCommandStep.java:114)
	at liquibase.command.core.DiffCommandStep.run(DiffCommandStep.java:89)
	at liquibase.command.CommandScope.execute(CommandScope.java:214)
	... 40 more

Any support ? Or should I revert to back to jmix 2.1 ?

Same problem for me!

Hello,

Caused by: java.lang.NullPointerException: Cannot invoke "String.matches(String)" because "<local8>" is null

Do you have a variable in your code that is named local8? (use search)
When you attempt an operation in Java on a string whose value is null, it gives an exception.
So you need to check for null the string variable before using it.
Something like
if (local8 != null) {
… .matches
}

or wrap it in try-except, or somehow make sure its not null.

Kind regards,
Mladen

Already did that. No such variable called local8.

Could be something in the liquibase changelog then.
If you changed some structure, apply your liquibase changes before the migration.
If it’s still problematic, delete the changelog, or parts of it that are causing a problem.

I have tried to recreate the changelog and the database. Despite that, I experience the same issue. Wondering if the liquibase version was upgraded in Jmix 2.2.

Does anyone knows how to dump logs when Jmix start parsing the entities to generate the change log?

The only way I found is to exclude “Check Liquibase Changelog Includes” from Run Configuration.

remove

It is just a work around!

That’s not helping. Checking liquibase changelog includes is not solving the NPE.

Somehow Jmix Studio 2.2 is definitely broken, reinstalling it from scratch and cleaning the caches is not helping.

Investigating the issue I found:

  1. Liquibase Exception affects only composite projects (Do you Samy use a composite project?)
  2. Even if I recreate the whole database the problem persists.
  3. The problem does not affect Hsqldb but Postgres (Do you Samy use a Postgres db?)

Question:
How did you get posted stack trace:

2024-03-07 14:17:29,560 [  52475]   WARN - #com.haulmont.jmixstudio.intellij.runconfiguration.stepbefore.SyncDbBeforeRunProcess - liquibase.exception.CommandExecutionException: java.lang.NullPointerException: Cannot invoke "String.matches(String)" because "<local8>" is null
liquibase.exception.LiquibaseException: liquibase.exception.CommandExecutionException: java.lang.NullPointerException: Cannot invoke "String.matches(String)" because "<local8>" is null
	at com.haulmont.jmixstudio.liquibase.LiquibaseCommandManager.doDiffToChangeLog(LiquibaseCommandManager.kt:313)
	......

Thanks Fulvio.

Here’re my answers:

  1. No I don’t use composite projects
  2. Yes the problem persists even if I recreate the whole new project with new environment
  3. Yes I am using Postgres db

The stack trace is coming from the Intellij idea logs through my Mac Console monitoring

Hi

Thanks for your feedback.

Here is a bug in Studio 2.2.0 release that affects certain projects.
Please check latest NIGHTLY Studio build (Installation :: Jmix Documentation), it contains the fix for the issue above.

1 Like

Thanks Alexander, it works.

The downside, there are errors and bugs. Not optimal.