Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null Pointer Exception During Diff Change Log Generation #2152

Closed
coylecullen opened this issue Oct 20, 2021 · 7 comments
Closed

Null Pointer Exception During Diff Change Log Generation #2152

coylecullen opened this issue Oct 20, 2021 · 7 comments

Comments

@coylecullen
Copy link
Contributor

coylecullen commented Oct 20, 2021

Liquibase Version:

      <plugin>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-maven-plugin</artifactId>
        <version>4.5.0</version>
        <configuration>
          <propertyFile>target/classes/liquibase.properties</propertyFile>
          <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
	</configuration>
      </plugin>

Database Vendor & Version:
mysql Ver 8.0.21 for macos10.15 on x86_64 (MySQL Community Server - GPL)

Operating System Type & Version:
MacOS Big Sur Version 11.4

Description

I'm experiencing a NPE when trying to generate a mysql.sql diffChangeLog file. I'm testing against multiple profiles and I can confirm that against a different profile, this exception doesn't get thrown. However, this other profile throws the exception.

Steps To Reproduce

I ran mvn resources:resources liquibase:diff -Pqa

The Configuration for the Diff changelog generation that threw the NPE:
liquibase.properties:

driver: com.mysql.jdbc.Driver
classpath: mysql-connector-java/5.1.46/mysql-connector-java-5.1.46.jar
url: jdbc:mysql://localhost:3306/qa?characterEncoding=utf-8
username: *
password: *
changeLogFile: src/liquibase/resources/changelog/nonprod/qa/initial-schema.mysql.sql
outputChangeLogFile: src/liquibase/resources/changelog/nonprod/qa/initial-schema.mysql.sql
diffChangeLogFile: src/liquibase/resources/changelog/nonprod/qa/qa-diff.mysql.sql

referenceDriver=com.mysql.jdbc.Driver
referenceClasspath=mysql-connector-java/5.1.46/mysql-connector-java-5.1.46.jar
referenceUrl=jdbc:mysql://localhost:3306/us?characterEncoding=utf-8
referenceUsername=*
referencePassword=*

Profile:

<profile>
      <id>qa</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <build>
        <filters>
          <filter>src/liquibase/filters/qa/db.properties</filter>
        </filters>
        <resources>
          <resource>
            <directory>src/liquibase/resources</directory>
            <filtering>true</filtering>
          </resource>
        </resources>
      </build>
    </profile>

I'm comparing two databases directly so I'm not using any snapshots for the diff change log generation.

Actual Behavior

[ERROR] Error setting up or running Liquibase:
[ERROR] liquibase.exception.CommandExecutionException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.liquibase:liquibase-maven-plugin:4.5.0:diff (default-cli) on project app: 
Error setting up or running Liquibase:
liquibase.exception.CommandExecutionException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    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 org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: 
Error setting up or running Liquibase:
liquibase.exception.CommandExecutionException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
    at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute (AbstractLiquibaseMojo.java:487)
    at org.liquibase.maven.plugins.LiquibaseDatabaseDiff.execute (LiquibaseDatabaseDiff.java:204)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    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 org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: 
Error setting up or running Liquibase:
liquibase.exception.CommandExecutionException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
    at org.liquibase.maven.plugins.AbstractLiquibaseMojo.lambda$null$0 (AbstractLiquibaseMojo.java:478)
    at liquibase.Scope.lambda$child$0 (Scope.java:177)
    at liquibase.Scope.child (Scope.java:186)
    at liquibase.Scope.child (Scope.java:176)
    at liquibase.Scope.child (Scope.java:155)
    at org.liquibase.maven.plugins.AbstractLiquibaseMojo.lambda$execute$1 (AbstractLiquibaseMojo.java:401)
    at liquibase.Scope.lambda$child$0 (Scope.java:177)
    at liquibase.Scope.child (Scope.java:186)
    at liquibase.Scope.child (Scope.java:176)
    at liquibase.Scope.child (Scope.java:155)
    at liquibase.Scope.child (Scope.java:239)
    at liquibase.Scope.child (Scope.java:243)
    at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute (AbstractLiquibaseMojo.java:338)
    at org.liquibase.maven.plugins.LiquibaseDatabaseDiff.execute (LiquibaseDatabaseDiff.java:204)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    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 org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: liquibase.exception.LiquibaseException: liquibase.exception.CommandExecutionException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
    at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog (CommandLineUtils.java:207)
    at org.liquibase.maven.plugins.LiquibaseDatabaseDiff.performLiquibaseTask (LiquibaseDatabaseDiff.java:259)
    at org.liquibase.maven.plugins.AbstractLiquibaseMojo.lambda$null$0 (AbstractLiquibaseMojo.java:475)
    at liquibase.Scope.lambda$child$0 (Scope.java:177)
    at liquibase.Scope.child (Scope.java:186)
    at liquibase.Scope.child (Scope.java:176)
    at liquibase.Scope.child (Scope.java:155)
    at org.liquibase.maven.plugins.AbstractLiquibaseMojo.lambda$execute$1 (AbstractLiquibaseMojo.java:401)
    at liquibase.Scope.lambda$child$0 (Scope.java:177)
    at liquibase.Scope.child (Scope.java:186)
    at liquibase.Scope.child (Scope.java:176)
    at liquibase.Scope.child (Scope.java:155)
    at liquibase.Scope.child (Scope.java:239)
    at liquibase.Scope.child (Scope.java:243)
    at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute (AbstractLiquibaseMojo.java:338)
    at org.liquibase.maven.plugins.LiquibaseDatabaseDiff.execute (LiquibaseDatabaseDiff.java:204)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    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 org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: liquibase.exception.CommandExecutionException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
    at liquibase.command.CommandScope.execute (CommandScope.java:153)
    at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog (CommandLineUtils.java:205)
    at org.liquibase.maven.plugins.LiquibaseDatabaseDiff.performLiquibaseTask (LiquibaseDatabaseDiff.java:259)
    at org.liquibase.maven.plugins.AbstractLiquibaseMojo.lambda$null$0 (AbstractLiquibaseMojo.java:475)
    at liquibase.Scope.lambda$child$0 (Scope.java:177)
    at liquibase.Scope.child (Scope.java:186)
    at liquibase.Scope.child (Scope.java:176)
    at liquibase.Scope.child (Scope.java:155)
    at org.liquibase.maven.plugins.AbstractLiquibaseMojo.lambda$execute$1 (AbstractLiquibaseMojo.java:401)
    at liquibase.Scope.lambda$child$0 (Scope.java:177)
    at liquibase.Scope.child (Scope.java:186)
    at liquibase.Scope.child (Scope.java:176)
    at liquibase.Scope.child (Scope.java:155)
    at liquibase.Scope.child (Scope.java:239)
    at liquibase.Scope.child (Scope.java:243)
    at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute (AbstractLiquibaseMojo.java:338)
    at org.liquibase.maven.plugins.LiquibaseDatabaseDiff.execute (LiquibaseDatabaseDiff.java:204)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    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 org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
    at liquibase.diff.output.changelog.DiffToChangeLog.print (DiffToChangeLog.java:199)
    at liquibase.diff.output.changelog.DiffToChangeLog.print (DiffToChangeLog.java:85)
    at liquibase.command.core.InternalDiffChangelogCommandStep.run (InternalDiffChangelogCommandStep.java:61)
    at liquibase.command.CommandScope.execute (CommandScope.java:147)
    at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog (CommandLineUtils.java:205)
    at org.liquibase.maven.plugins.LiquibaseDatabaseDiff.performLiquibaseTask (LiquibaseDatabaseDiff.java:259)
    at org.liquibase.maven.plugins.AbstractLiquibaseMojo.lambda$null$0 (AbstractLiquibaseMojo.java:475)
    at liquibase.Scope.lambda$child$0 (Scope.java:177)
    at liquibase.Scope.child (Scope.java:186)
    at liquibase.Scope.child (Scope.java:176)
    at liquibase.Scope.child (Scope.java:155)
    at org.liquibase.maven.plugins.AbstractLiquibaseMojo.lambda$execute$1 (AbstractLiquibaseMojo.java:401)
    at liquibase.Scope.lambda$child$0 (Scope.java:177)
    at liquibase.Scope.child (Scope.java:186)
    at liquibase.Scope.child (Scope.java:176)
    at liquibase.Scope.child (Scope.java:155)
    at liquibase.Scope.child (Scope.java:239)
    at liquibase.Scope.child (Scope.java:243)
    at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute (AbstractLiquibaseMojo.java:338)
    at org.liquibase.maven.plugins.LiquibaseDatabaseDiff.execute (LiquibaseDatabaseDiff.java:204)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    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 org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
    at liquibase.diff.output.changelog.DiffToChangeLog$1.run (DiffToChangeLog.java:182)
    at liquibase.Scope.lambda$child$0 (Scope.java:177)
    at liquibase.Scope.child (Scope.java:186)
    at liquibase.Scope.child (Scope.java:176)
    at liquibase.Scope.child (Scope.java:155)
    at liquibase.diff.output.changelog.DiffToChangeLog.print (DiffToChangeLog.java:127)
    at liquibase.diff.output.changelog.DiffToChangeLog.print (DiffToChangeLog.java:85)
    at liquibase.command.core.InternalDiffChangelogCommandStep.run (InternalDiffChangelogCommandStep.java:61)
    at liquibase.command.CommandScope.execute (CommandScope.java:147)
    at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog (CommandLineUtils.java:205)
    at org.liquibase.maven.plugins.LiquibaseDatabaseDiff.performLiquibaseTask (LiquibaseDatabaseDiff.java:259)
    at org.liquibase.maven.plugins.AbstractLiquibaseMojo.lambda$null$0 (AbstractLiquibaseMojo.java:475)
    at liquibase.Scope.lambda$child$0 (Scope.java:177)
    at liquibase.Scope.child (Scope.java:186)
    at liquibase.Scope.child (Scope.java:176)
    at liquibase.Scope.child (Scope.java:155)
    at org.liquibase.maven.plugins.AbstractLiquibaseMojo.lambda$execute$1 (AbstractLiquibaseMojo.java:401)
    at liquibase.Scope.lambda$child$0 (Scope.java:177)
    at liquibase.Scope.child (Scope.java:186)
    at liquibase.Scope.child (Scope.java:176)
    at liquibase.Scope.child (Scope.java:155)
    at liquibase.Scope.child (Scope.java:239)
    at liquibase.Scope.child (Scope.java:243)
    at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute (AbstractLiquibaseMojo.java:338)
    at org.liquibase.maven.plugins.LiquibaseDatabaseDiff.execute (LiquibaseDatabaseDiff.java:204)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    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 org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.NullPointerException
    at liquibase.sqlgenerator.core.SetColumnRemarksGenerator.generateSql (SetColumnRemarksGenerator.java:50)
    at liquibase.sqlgenerator.core.SetColumnRemarksGenerator.generateSql (SetColumnRemarksGenerator.java:15)
    at liquibase.sqlgenerator.SqlGeneratorChain.generateSql (SqlGeneratorChain.java:30)
    at liquibase.sqlgenerator.SqlGeneratorFactory.generateSql (SqlGeneratorFactory.java:220)
    at liquibase.sqlgenerator.SqlGeneratorFactory.generateSql (SqlGeneratorFactory.java:206)
    at liquibase.serializer.core.formattedsql.FormattedSqlChangeLogSerializer.serialize (FormattedSqlChangeLogSerializer.java:53)
    at liquibase.serializer.core.formattedsql.FormattedSqlChangeLogSerializer.write (FormattedSqlChangeLogSerializer.java:113)
    at liquibase.diff.output.changelog.DiffToChangeLog.print (DiffToChangeLog.java:244)
    at liquibase.diff.output.changelog.DiffToChangeLog$1.run (DiffToChangeLog.java:137)
    at liquibase.Scope.lambda$child$0 (Scope.java:177)
    at liquibase.Scope.child (Scope.java:186)
    at liquibase.Scope.child (Scope.java:176)
    at liquibase.Scope.child (Scope.java:155)
    at liquibase.diff.output.changelog.DiffToChangeLog.print (DiffToChangeLog.java:127)
    at liquibase.diff.output.changelog.DiffToChangeLog.print (DiffToChangeLog.java:85)
    at liquibase.command.core.InternalDiffChangelogCommandStep.run (InternalDiffChangelogCommandStep.java:61)
    at liquibase.command.CommandScope.execute (CommandScope.java:147)
    at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog (CommandLineUtils.java:205)
    at org.liquibase.maven.plugins.LiquibaseDatabaseDiff.performLiquibaseTask (LiquibaseDatabaseDiff.java:259)
    at org.liquibase.maven.plugins.AbstractLiquibaseMojo.lambda$null$0 (AbstractLiquibaseMojo.java:475)
    at liquibase.Scope.lambda$child$0 (Scope.java:177)
    at liquibase.Scope.child (Scope.java:186)
    at liquibase.Scope.child (Scope.java:176)
    at liquibase.Scope.child (Scope.java:155)
    at org.liquibase.maven.plugins.AbstractLiquibaseMojo.lambda$execute$1 (AbstractLiquibaseMojo.java:401)
    at liquibase.Scope.lambda$child$0 (Scope.java:177)
    at liquibase.Scope.child (Scope.java:186)
    at liquibase.Scope.child (Scope.java:176)
    at liquibase.Scope.child (Scope.java:155)
    at liquibase.Scope.child (Scope.java:239)
    at liquibase.Scope.child (Scope.java:243)
    at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute (AbstractLiquibaseMojo.java:338)
    at org.liquibase.maven.plugins.LiquibaseDatabaseDiff.execute (LiquibaseDatabaseDiff.java:204)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    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 org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

@molivasdat
Copy link
Contributor

Hi @coylecullen Thanks for writing up this issue. The only thing I can think of based on the stack trace provided is that there may be some invalid characters in a column comment.
liquibase.sqlgenerator.core.SetColumnRemarksGenerator.generateSql (SetColumnRemarksGenerator.java:50)
Not having your databases available you might check the comments on the column and see if this gives us a clue on what could be causing the NPE.

@coylecullen
Copy link
Contributor Author

coylecullen commented Nov 1, 2021

I was doing some investigation and one of my colleagues pointed this out:
With that line number of the NPE it points us to this line:
+ DataTypeFactory.getInstance().fromDescription(statement.getColumnDataType(), database).toDatabaseDataType(database)

+ DataTypeFactory.getInstance().fromDescription(statement.getColumnDataType(), database).toDatabaseDataType(database)

We noticed within the SetColumnRemarksStatement constructor, the ColumnDataType gets set to null.

this(catalogName, schemaName, tableName, columnName, remarks, null);

So when the order of calls goes down the line, its calling:
null.toDatabaseDataType(database).

Do you know why this gets set to null upon object creation? Not ruling out an invalid character in comments but I think this may be the source of the NPE (I've been digging around those trying to see if theres anything obvious but working with thousands of columns, it's a little hard to pin point which table could be causing invalid characters). If there is anything I'm missing please let me know! Thanks for your help

@WangHengZhi
Copy link

I get this NPE too !

coylecullen added a commit to coylecullen/liquibase that referenced this issue Nov 5, 2021
@coylecullen
Copy link
Contributor Author

Created a PR for my potential fix: #2188 this did get rid of the NPE and I was able to complete my diff change log generation. There might be a bigger issue because I can't see why this alter statement is getting hit from the beginning (Both tables look exactly the same to me) but I guess thats for a separate discussion.
I've had issues with other comparisons where even after I run the updates to get one database up to date with the other reference database, when I test a re-generation of the diff change log (to make sure there are no more differences and that my updates went through properly) some alter statements still show up in the diff change log.

@coylecullen
Copy link
Contributor Author

I was doing some investigation and one of my colleagues pointed this out: With that line number of the NPE it points us to this line: + DataTypeFactory.getInstance().fromDescription(statement.getColumnDataType(), database).toDatabaseDataType(database)

+ DataTypeFactory.getInstance().fromDescription(statement.getColumnDataType(), database).toDatabaseDataType(database)

We noticed within the SetColumnRemarksStatement constructor, the ColumnDataType gets set to null.

this(catalogName, schemaName, tableName, columnName, remarks, null);

So when the order of calls goes down the line, its calling: null.toDatabaseDataType(database).

Do you know why this gets set to null upon object creation? Not ruling out an invalid character in comments but I think this may be the source of the NPE (I've been digging around those trying to see if theres anything obvious but working with thousands of columns, it's a little hard to pin point which table could be causing invalid characters). If there is anything I'm missing please let me know! Thanks for your help

This idea was incorrect but the issue of the database type being null was the cause of the NPE. From what I saw, there was no reference to that constructor in the liquibase repo.

@molivasdat
Copy link
Contributor

Thanks for chasing this down. We will look into what is setting this to null and most likely changing it.

@nvoxland
Copy link
Contributor

I'm going to close this issue because the actual null pointer was fixed in #942 or other changes in later releases. I'm not able to replicate the null pointer exception with the current code.

BUT: I was able to see a problem that while the null pointer you were seeing has been addressed by a check to ensure the needed columnDataType attribute is set, it will just move you onto a getting a validation error from the generated changeset vs. a null pointer exception. "

Pull request #2188 handles generating the changelog correctly and we'll get that merged in, but since this is a different problem I'll still close this as "already fixed".

If anyone is still seeing this null pointer exception in 4.6.2+, give me more details on how you could reproduce it so we can look more at that problem.

Conditioning++ automation moved this from To Do to Done Dec 22, 2021
@nvoxland nvoxland removed this from Done in Conditioning++ Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants