Migration from 2.29 to 2.34 Fails: System property dhis2.home not set

Current environment
PostgreSQL 12
TomCat 9

Database was previously on Linux machine.

Everything goes well if I do fresh installation but not upgrade. I am getting errors below:

01-Sep-2020 15:38:47.314 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.36]
01-Sep-2020 15:38:47.345 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\dhis.war]
01-Sep-2020 15:39:44.495 INFO [main] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.

  • INFO 2020-09-01T15:39:45,667 System property dhis2.home not set (LogOnceLogger.java [main])
  • INFO 2020-09-01T15:39:45,683 Environment variable DHIS2_HOME points to C:\DHIS2 (LogOnceLogger.java [main])
  • INFO 2020-09-01T15:39:45,714 File C:\DHIS2\dhis-google-auth.json does not exist (LogOnceLogger.java [main])
  • INFO 2020-09-01T15:39:45,714 Could not find dhis-google-auth.json (LogOnceLogger.java [main])
  • INFO 2020-09-01T15:39:52,806 Monitoring metric for key monitoring.jvm.enabled is disabled (MetricsEnabler.java [main])
  • INFO 2020-09-01T15:39:52,806 Monitoring metric for key monitoring.cpu.enabled is disabled (MetricsEnabler.java [main])
  • INFO 2020-09-01T15:39:52,806 Monitoring metric for key monitoring.uptime.enabled is disabled (MetricsEnabler.java [main])
  • INFO 2020-09-01T15:39:52,806 Monitoring metric for key monitoring.dbpool.enabled is disabled (MetricsEnabler.java [main])
  • INFO 2020-09-01T15:39:52,806 Monitoring metric for key monitoring.hibernate.enabled is disabled (MetricsEnabler.java [main])
  • INFO 2020-09-01T15:39:52,806 Monitoring metric for key monitoring.api.enabled is disabled (MetricsEnabler.java [main])
  • INFO 2020-09-01T15:39:56,390 Hibernate configuration loaded: dialect: ‘org.hisp.dhis.hibernate.dialect.DhisPostgresDialect’, region factory: ‘org.hibernate.cache.ehcache.EhCacheRegionFactory’, connection pool max size: 80 (DefaultHibernateConfigurationProvider.java [main])
  • WARN 2020-09-01T15:39:58,124 DB: column “capturecoordinates” of relation “program” already exists, skipping (SQL State: 42701 - Error Code: 0) (Slf4jLog.java [main])
  • ERROR 2020-09-01T15:39:58,311 Migration of schema “public” to version 2.31.1 - Migrations for release v31 failed! Changes successfully rolled back. (Slf4jLog.java [main])

springframework.beans.factory.BeanCreationException: Error creating bean with name ‘flyway’ defined in org.hisp.dhis.db.migration.config.FlywayConfig: Invocation of init method failed; nested exception is org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException:

Migration V2_31_1__Migrations_for_release_v31.sql failed

SQL State : 42P01
Error Code : 0
Message : ERROR: relation “predictorgroup” does not exist
Location : org/hisp/dhis/db/migration/2.31/V2_31_1__Migrations_for_release_v31.sql (C:\Program Files\Apache Software Foundation\Tomcat 9.0\file:\C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\dhis2\WEB-INF\lib\dhis-support-db-migration-2.34.0.jar!\org\hisp\dhis\db\migration\2.31\V2_31_1__Migrations_for_release_v31.sql)
Line : 261
Statement : alter table predictorgroup add column if not exists translations jsonb

Can anyone help on this?

Hi @fraka!

Thanks for posting this issue. I am hoping our flyway expert @Ameen can assist you :slight_smile:

Gintare

Thanks. Can you assist me to reach him? The issue is failing me.

Make sure you are upgrading from 2.29 through 2.30, 2.31, 2.32, 2.33 to 2.34 and not straight to 2.34 from 2.29.

Make sure you follow the online instructions including dropping SQL views as you go. For some reason on our system, I had to use psql or PGAdmin to manually list and drop views and materialized views - for some unexplained reason, there’s been one materilaized view on one box that prevents us from upgrading the DB at times.

Looking at your log, that System property dhis2.home not set is normal - at that point it looks for the envionment variable and sets it accordingly - in your case to c:\dhis2. The ‘dhis-google-auth.json’ does not exist message is OK if you’re not using dhis-google-auth. The monitoring metrics being disabled is OK if you haven’t set up monitoring… there’s definitely a DB upgrade issue, just not sure that I can tell from that log what it is.

Thanks @Edward_Robinson - your suggestion worked well for me. I did upgrade from 2.29 through 2.30, 2.31, 2.32, 2.33 to 2.34 and all went well.

Thanks.

1 Like

Just as an FYI. From 2.30 onwards you can upgrade to any DHIS2 version directly. Example: From 2.30 directly to 2.34 or from 2.31 to 2.33 or from 2.30 to 2.35 etc.
But you have to upgrade until 2.30 sequentially. Flyway ensures that from 2.30, direct upgrading to higher versions is possible.

Hi @fraka

Could you help to provide detail instruction on how to migrate 2.30, 2.31, 2.32, 2.33 to 2.34.

Thanks!