question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.NullPointerException during DIFF operation

See original GitHub issue

Liquibase Version

Starting Liquibase at 14:54:49 (version 4.2.2 #36 built at 2020-12-09 20:07+0000)
Liquibase Version: 4.2.2
Liquibase Community 4.2.2 by Datical
Running Java under /usr/lib/jvm/java-11-openjdk-amd64 (Version 11.0.9.1)

Command to generate snapshot

liquibase \
        --driver=org.postgresql.Driver \
        --classpath=postgresql-42.2.18.jar \
        --url="jdbc:postgresql://$SQL_IP/$SQL_DATABASE" \
        --username="$SQL_USERNAME" \
        --password="$SQL_PASSWORD" \
        --changeLogFile="$CHANGELOG_MASTER_FILE" \
        --liquibaseSchemaName=$SQL_LIQUIBASE_SCHEMA \
        --defaultSchemaName=$SQL_APPLICATION_SCHEMA \
        --contexts=$ENVIRONMENT \
        --outputFile="$STATUS_LOG_FOLDER/snapshot.after.json" \
        snapshot \
        --snapshotFormat=json

Command to generate diff

liquibase \
        --driver=org.postgresql.Driver \
        --classpath=postgresql-42.2.18.jar \
        --url="offline:postgresql?snapshot=$STATUS_LOG_FOLDER/snapshot.before.json" \
        --referenceUrl="jdbc:postgresql://$SQL_IP/$SQL_DATABASE" \
        --referenceusername="$SQL_USERNAME" \
        --referencepassword="$SQL_PASSWORD" \
        --referenceDefaultSchemaName=$SQL_APPLICATION_SCHEMA \
        --liquibaseSchemaName=$SQL_LIQUIBASE_SCHEMA \
        --contexts=$ENVIRONMENT \
        --outputFile="$STATUS_LOG_FOLDER/diff.txt" \
        diff

Thsi is the error I’m getting when launching DIFF command

[2021-01-15 14:53:41] FINE [liquibase.servicelocator] Loaded liquibase.diff.DiffGenerator instance liquibase.diff.core.StandardDiffGenerator
Unexpected error running Liquibase: java.lang.NullPointerException
For more information, please use the --logLevel flag
[2021-01-15 14:53:41] SEVERE [liquibase.integration] Unexpected error running Liquibase: java.lang.NullPointerException
liquibase.exception.LiquibaseException: liquibase.command.CommandExecutionException: java.lang.NullPointerException
        at liquibase.integration.commandline.CommandLineUtils.doDiff(CommandLineUtils.java:173)
        at liquibase.integration.commandline.Main.doMigration(Main.java:1480)
        at liquibase.integration.commandline.Main$1.lambda$run$0(Main.java:361)
        at liquibase.Scope.lambda$child$0(Scope.java:160)
        at liquibase.Scope.child(Scope.java:169)
        at liquibase.Scope.child(Scope.java:159)
        at liquibase.Scope.child(Scope.java:138)
        at liquibase.Scope.child(Scope.java:222)
        at liquibase.Scope.child(Scope.java:226)
        at liquibase.integration.commandline.Main$1.run(Main.java:360)
        at liquibase.integration.commandline.Main$1.run(Main.java:193)
        at liquibase.Scope.child(Scope.java:169)
        at liquibase.Scope.child(Scope.java:145)
        at liquibase.integration.commandline.Main.run(Main.java:193)
        at liquibase.integration.commandline.Main.main(Main.java:156)
Caused by: liquibase.command.CommandExecutionException: java.lang.NullPointerException
        at liquibase.command.AbstractCommand.execute(AbstractCommand.java:24)
        at liquibase.integration.commandline.CommandLineUtils.doDiff(CommandLineUtils.java:171)
        ... 14 more
Caused by: java.lang.NullPointerException
        at liquibase.diff.compare.core.IndexComparator$1.areEqual(IndexComparator.java:123)
        at liquibase.diff.ObjectDifferences.compare(ObjectDifferences.java:70)
        at liquibase.diff.ObjectDifferences.compare(ObjectDifferences.java:50)
        at liquibase.diff.compare.core.IndexComparator.findDifferences(IndexComparator.java:113)
        at liquibase.diff.compare.DatabaseObjectComparatorChain.findDifferences(DatabaseObjectComparatorChain.java:99)
        at liquibase.diff.compare.DatabaseObjectComparatorFactory.findDifferences(DatabaseObjectComparatorFactory.java:166)
        at liquibase.diff.core.StandardDiffGenerator.compareObjectType(StandardDiffGenerator.java:90)
        at liquibase.diff.core.StandardDiffGenerator.compare(StandardDiffGenerator.java:52)
        at liquibase.diff.DiffGeneratorFactory.compare(DiffGeneratorFactory.java:107)
        at liquibase.command.core.DiffCommand.createDiffResult(DiffCommand.java:152)
        at liquibase.command.core.DiffCommand.run(DiffCommand.java:136)
        at liquibase.command.AbstractCommand.execute(AbstractCommand.java:19)
        ... 15 more

Testing Criteria

This needs to be tested against AWS Aurora PostgreSQL 10.11 compatible.

Source Line: IndexComparator.java:123

I added the logLevel=DEBUG as suggested, but besided having the stacktrace I’m not getting additional information.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
NicolaSpreaficocommented, Feb 18, 2021

Hi, my does not have computed column indexes. Right now I’m simply waiting a reply in this issue for the resolution, for the moment I disabled the snapshot part in my script

0reactions
nvoxlandcommented, Apr 5, 2021

Fixed in #1758 in 4.4.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - What is a NullPointerException, and how do I fix it?
When you dereference a pointer p , you say "give me the data at the location stored in "p". When p is a...
Read more >
How to Fix and Avoid NullPointerException in Java - Rollbar
The NullPointerException occurs due to a situation in application code where an uninitialized object is attempted to be accessed or modified.
Read more >
How to deal with NullPointerException in Java with Examples
NullPointerException in Java is nothing but an error or precisely an exception that occurs if we tried to perform any operation on an...
Read more >
Java NullPointerException - Detect, Fix, and Best Practices
This is one of the most common occurrences of java.lang.NullPointerException because it's the caller who is passing the null argument. The below ...
Read more >
Null Pointer Exception In Java - GeeksforGeeks
NullPointerException is a RuntimeException. In Java, a special null value can be assigned to an object reference. NullPointerException is thrown ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found