After completing a patch upgrade of Semarchy xDM, administrators may encounter a NullPointerException: Null code error when attempting a model deployment operation. The error is most likely to occur in environments where an admin has configured database views, a new feature introduced in version 5.3 of the Semarchy xDM platform. Reference our official documentation for more info on configuring database views.

Below is an excerpt of the stack trace for this specific error.

java.lang.NullPointerException: Null code
  at com.semarchy.mdm.runtime.model.dbschema.impl.AutoValue_DBView.<init>(
  at com.semarchy.mdm.runtime.model.dbschema.impl.DBView.create(
  at com.semarchy.mdm.runtime.model.dbschema.impl.DBSchema.addView(
  at com.semarchy.mdm.runtime.model.dbschema.reveng.PostgreSQLSchemaReveng.reverseViews(
  at com.semarchy.mdm.runtime.model.dbschema.reveng.PostgreSQLSchemaReveng.reverseSchema(
  at com.semarchy.mdm.runtime.model.dbschema.reveng.SchemaRevengFactory.reverseSchema(
  at com.semarchy.mdm.runtime.model.dbschema.reveng.SchemaRevengFactory.reverseSchema(
  at com.semarchy.mdm.datahub.admin.impl.DataLocationSchemaSupport.getSchemaDiffForUpdate(
  at com.semarchy.mdm.datahub.admin.impl.DefaultDataLocationAdminService.getSchemaDiffForUpdate(
  at com.semarchy.ui.platform.admin.wizards.ShowDDLPage$
  at org.eclipse.jface.operation.ModalContext$ModalContextThread$
  at org.eclipse.rap.rwt.internal.lifecycle.ContextUtil.runNonUIThreadWithFakeContext(
  at org.eclipse.rap.rwt.internal.service.UISessionImpl.exec(
  at org.eclipse.jface.operation.ModalContext$

Root Cause Analysis

  1. From the stack trace, we can interpret that the schema reverse is failing while reversing a database view.
  2. From the stack trace, we can interpret that the information_schema.views.view_definition column is null for one of the database views of the data location schema.
  3. From the stack trace, we can interpret that a condition may exist in which the executing user may lack the necessary permissions to see the definition of a view, thereby emulating a null view_definition.
  4. In summary, we can conclude once the view with a null view_definition is identified that:
  • removing the view temporarily will bypass the error.
  • granting the executing user owner permissions on the view will resolve the error.


1. Run the following SQL query to identify view(s) which match the criteria (missing/blank view_definition column); do not forget to replace %CURRENT_SCHEMA% with the name of the current data location schema.

select v.table_name, v.view_definition, d.description 
 from information_schema."views" v
 inner join pg_catalog.pg_class c
 on v.table_schema = %CURRENT_SCHEMA%
 and c.oid = v.table_name::regclass::oid
 left join pg_catalog.pg_description d
 on d.objoid = v.table_name::regclass::oid

2. Change the owner of the view with one of the following methods:

  • Grant the data location user owner permissions


  • Drop the view in the schema and recreate it by re-deploying the model.


Semarchy Release Notes - Understanding Database Views

Semarchy Integration Guide - Configuring Database Views