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

Cannot invoke “liquibase.datatype.LiquibaseDataType.getName()” because “liquibaseDataType” is null #161

Open
JanCizmar opened this issue Oct 24, 2024 · 1 comment

Comments

@JanCizmar
Copy link

I've already posted it on the forum, but I've got no reaction.

So I will try it here.

I am getting this error in my specific case and I believe, there is a bug, because it should never throw NPE. Instead it should tell me what's wrong on which field.

> Task :billing-app:diffChangelog FAILED
14:54:58.163 [main] INFO org.hibernate.engine.transaction.jta.platform.internal.JtaPlatformInitiator -- HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)
[2024-10-22 14:54:58] INFO [liquibase.ext] Using dialect io.tolgee.dialects.postgres.CustomPostgreSQLDialect
[2024-10-22 14:54:58] WARNING [liquibase.command] Ignoring the global liquibase.driver value in favor of the command value.
[2024-10-22 14:54:58] INFO [liquibase.snapshot] Creating snapshot
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table subscription_plan
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table subscription_plan
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table self_hosted_ee_subscription_plan
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table self_hosted_ee_subscription_plan
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table self_hosted_ee_subscription
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table self_hosted_ee_subscription
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table invoice
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table invoice
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table usage_event
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table usage_event
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table extra_credits_order
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table extra_credits_order
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table subscription
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table subscription
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table organization_billing_info
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table organization_billing_info
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table previous_instance_id
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table previous_instance_id
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table mt_credits_price
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table mt_credits_price
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table invoice_task
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table invoice_task
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table self_hosted_ee_subscription_plan_for_organization_ids
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table self_hosted_ee_subscription_plan_for_organization_ids
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table subscription_plan_for_organization_ids
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table subscription_plan_for_organization_ids
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table previous_instance_id
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table previous_instance_id
[2024-10-22 14:54:58] INFO [liquibase.ext] Found table subscription_plan
[2024-10-22 14:54:58] INFO [liquibase.ext] Found primary key subscription_planPK
[2024-10-22 14:54:58] INFO [liquibase.ext] Found index IDXse3opm2w57e5v0tolsj0ar5ki
[2024-10-22 14:54:58] INFO [liquibase.ext] Found column id bigint
[2024-10-22 14:54:58] INFO [liquibase.ext] Found column created_at timestamp(6)
[2024-10-22 14:54:58] INFO [liquibase.ext] Found column updated_at timestamp(6)
[2024-10-22 14:54:58] INFO [liquibase.ext] Found column translation_limit bigint
[2024-10-22 14:54:58] INFO [liquibase.ext] Found column available_until timestamp(6)
[2024-10-22 14:54:58] INFO [liquibase.ext] Found column enabled_features varchar[]
[2024-10-22 14:54:58] INFO [liquibase.command] Logging exception.
ERROR: Exception Details
[2024-10-22 14:54:58] INFO [liquibase.ui] ERROR: Exception Details
ERROR: Exception Primary Class:  NullPointerException
[2024-10-22 14:54:58] INFO [liquibase.ui] ERROR: Exception Primary Class:  NullPointerException
ERROR: Exception Primary Reason:  Cannot invoke "liquibase.datatype.LiquibaseDataType.getName()" because "liquibaseDataType" is null
[2024-10-22 14:54:58] INFO [liquibase.ui] ERROR: Exception Primary Reason:  Cannot invoke "liquibase.datatype.LiquibaseDataType.getName()" because "liquibaseDataType" is null
ERROR: Exception Primary Source:  PostgreSQL 13.13 (Debian 13.13-1.pgdg120+1)
[2024-10-22 14:54:58] INFO [liquibase.ui] ERROR: Exception Primary Source:  PostgreSQL 13.13 (Debian 13.13-1.pgdg120+1)
[2024-10-22 14:54:58] INFO [liquibase.command] Command execution complete
[2024-10-22 14:54:58] SEVERE [liquibase.integration] Cannot invoke "liquibase.datatype.LiquibaseDataType.getName()" because "liquibaseDataType" is null
liquibase.exception.CommandExecutionException: java.lang.NullPointerException: Cannot invoke "liquibase.datatype.LiquibaseDataType.getName()" because "liquibaseDataType" is null
	at liquibase.command.CommandScope.execute(CommandScope.java:258)
	at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:51)
	at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:21)
	at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
	at picocli.CommandLine.access$1300(CommandLine.java:145)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
	at picocli.CommandLine.execute(CommandLine.java:2078)
	at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$2(LiquibaseCommandLine.java:404)
	at liquibase.Scope.child(Scope.java:200)
	at liquibase.Scope.child(Scope.java:176)
	at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$3(LiquibaseCommandLine.java:379)
	at liquibase.Scope.child(Scope.java:200)
	at liquibase.Scope.child(Scope.java:176)
	at liquibase.integration.commandline.LiquibaseCommandLine.execute(LiquibaseCommandLine.java:376)
	at liquibase.integration.commandline.LiquibaseCommandLine.main(LiquibaseCommandLine.java:97)
Caused by: java.lang.NullPointerException: Cannot invoke "liquibase.datatype.LiquibaseDataType.getName()" because "liquibaseDataType" is null
	at liquibase.util.SqlUtil.parseValue(SqlUtil.java:244)
	at liquibase.ext.hibernate.snapshot.ColumnSnapshotGenerator.snapshotColumn(ColumnSnapshotGenerator.java:130)
	at liquibase.ext.hibernate.snapshot.ColumnSnapshotGenerator.addTo(ColumnSnapshotGenerator.java:78)
	at liquibase.ext.hibernate.snapshot.HibernateSnapshotGenerator.snapshot(HibernateSnapshotGenerator.java:82)
	at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:60)
	at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:313)
	at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:455)
	at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:477)
	at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:368)
	at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:331)
	at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:106)
	at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:59)
	at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:37)
	at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:214)
	at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:187)
	at liquibase.command.core.DiffCommandStep.generateDatabaseShapshot(DiffCommandStep.java:208)
	at liquibase.command.core.DiffCommandStep.createReferenceSnapshot(DiffCommandStep.java:195)
	at liquibase.command.core.DiffCommandStep.createDiffResult(DiffCommandStep.java:115)
	at liquibase.command.core.DiffCommandStep.run(DiffCommandStep.java:91)
	at liquibase.command.CommandScope.execute(CommandScope.java:220)
	... 18 more


Unexpected error running Liquibase: Cannot invoke "liquibase.datatype.LiquibaseDataType.getName()" because "liquibaseDataType" is null

liquibase.exception.CommandExecutionException: java.lang.NullPointerException: Cannot invoke "liquibase.datatype.LiquibaseDataType.getName()" because "liquibaseDataType" is null
	at liquibase.command.CommandScope.execute(CommandScope.java:258)
	at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:51)
	at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:21)
	at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
	at picocli.CommandLine.access$1300(CommandLine.java:145)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
Exception Details

	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
Exception Primary Class:  NullPointerException

Exception Primary Reason:  Cannot invoke "liquibase.datatype.LiquibaseDataType.getName()" because "liquibaseDataType" is null

	at picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
Exception Primary Source:  PostgreSQL 13.13 (Debian 13.13-1.pgdg120+1)

	at picocli.CommandLine.execute(CommandLine.java:2078)
	at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$2(LiquibaseCommandLine.java:404)
	at liquibase.Scope.child(Scope.java:200)
	at liquibase.Scope.child(Scope.java:176)
	at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$3(LiquibaseCommandLine.java:379)
	at liquibase.Scope.child(Scope.java:200)
	at liquibase.Scope.child(Scope.java:176)
	at liquibase.integration.commandline.LiquibaseCommandLine.execute(LiquibaseCommandLine.java:376)
	at liquibase.integration.commandline.LiquibaseCommandLine.main(LiquibaseCommandLine.java:97)
Caused by: java.lang.NullPointerException: Cannot invoke "liquibase.datatype.LiquibaseDataType.getName()" because "liquibaseDataType" is null
	at liquibase.util.SqlUtil.parseValue(SqlUtil.java:244)
	at liquibase.ext.hibernate.snapshot.ColumnSnapshotGenerator.snapshotColumn(ColumnSnapshotGenerator.java:130)
	at liquibase.ext.hibernate.snapshot.ColumnSnapshotGenerator.addTo(ColumnSnapshotGenerator.java:78)
	at liquibase.ext.hibernate.snapshot.HibernateSnapshotGenerator.snapshot(HibernateSnapshotGenerator.java:82)
	at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:60)
	at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:313)
	at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:455)
	at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:477)
	at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:368)
Caused by: java.lang.NullPointerException: Cannot invoke "liquibase.datatype.LiquibaseDataType.getName()" because "liquibaseDataType" is null

	at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:331)
	at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:106)
	at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:59)
	at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:37)
	at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:214)
	at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:187)
	at liquibase.command.core.DiffCommandStep.generateDatabaseShapshot(DiffCommandStep.java:208)
	at liquibase.command.core.DiffCommandStep.createReferenceSnapshot(DiffCommandStep.java:195)
	at liquibase.command.core.DiffCommandStep.createDiffResult(DiffCommandStep.java:115)
	at liquibase.command.core.DiffCommandStep.run(DiffCommandStep.java:91)
	at liquibase.command.CommandScope.execute(CommandScope.java:220)
	... 18 more

I tried to debug using IntelliJ idea, but its not easy, because it’s look like liquibase is actually run using external command.

I don’t even know which field is causing this error.

I do suspect this one with custom type (io.hypersistence.utils.hibernate.type.array.EnumArrayType)

  @Type(
    EnumArrayType::class,
    parameters = [
      Parameter(
        name = EnumArrayType.SQL_ARRAY_TYPE,
        value = "varchar",
      ),
    ],
  )
  @ColumnDefault("ARRAY[]::varchar[]")
  @Column(name = "enabled_features", columnDefinition = "varchar[]")
  override var enabledFeatures: Array<Feature> = arrayOf(),

I only get the error for separate “billing” module. However, for other modules, very similar custom types work correctly.

Can anyone point me to the right direction?

@stevesaliman
Copy link
Collaborator

I'm fairly sure this is a problem with Liquibase and not the Gradle plugin.

If you run with the --debug flag, the output should include a line that starts with Running 'liquibase, which tells you exactly how the plugin is calling Liquibase. If that line looks correct, and the classpath is also correct, then this would be a Liquibase issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants