Error Upgrading from 2.35.8 to 2.37.0

Hello,

I am trying to upgrade DHIS2 from 2.35.8 to 2.37.0, getting an error summarized in the logs below.

" INFO 2021-12-02T10:30:14,198 No duplicate mappings for categoryoption to usergroups. Skipping duplicate cleanup migration (V2_36_4__Remove_duplicate_mappings_from_categoryoption_to_usergroups.java [localhost-startStop-1])

  • ERROR 2021-12-02T10:30:14,245 Migration of schema “public” to version “2.36.6 - Remove duplicate mappings from programstage to usergroups” failed! Changes successfully rolled back. (Slf4jLog.java [localhost-startStop-1])
  • WARN 2021-12-02T10:30:14,261 Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘webMvcConfig’: Unsatisfied dependency expressed through field ‘userSettingService’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.hisp.dhis.user.UserSettingService’ defined in URL [jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%208.5/webapps/ROOT/WEB-INF/lib/dhis-service-core-2.37.0.jar!/org/hisp/dhis/user/DefaultUserSettingService.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.hisp.dhis.user.UserSettingStore’ defined in URL [jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%208.5/webapps/ROOT/WEB-INF/lib/dhis-service-core-2.37.0.jar!/org/hisp/dhis/user/hibernate/HibernateUserSettingStore.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘flyway’ defined in class path resource [org/hisp/dhis/db/migration/config/FlywayConfig.class]: Invocation of init method failed; nested exception is org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException: SQL State : 42703
    Error Code : 0
    Message : ERROR: column psuga.programid does not exist
    Hint: Perhaps you meant to reference the column “ps.programid”.
    Position: 197"

Kindly asking for assistance on troubleshooting the error.

Regards,
Cynthia.

Hi Cynthia, I’m not sure whether we can directly upgrade from 2.35 to 2.37. I’m not an expert, but can you try upgrading first to 2.36 and then to 2.37 ?

Hi @jthomas ,

I have tried upgrading to all 2.36 versions and now 2.37, it gives the same error. The documentation says you can upgrade from 2.35 directly to latest versions. The restriction only applies to lower versions where you would have to upgrade step by step.

Perhaps @Gassim would have some ideas on how to go about resolving the error

Regards,
Cynthia.

1 Like

Hi @ckamb,
Thank you for the tag! I would love to help by asking you some questions about the steps as well as the environment, and then if we can’t find the solution we could share your post to find support. I see that it might be an issue with column ps.programid, but let’s make sure first!

Yes, you are correct, for version v2.30 and above it’s possible to upgrade directly to any higher version. You mentioned the docs so I trust that you followed all the steps (including dropping the SQL views); however, I wonder if the environment software installation require upgrades as well?

Please, what are the versions of your Java, PostgreSQL, and Tomcat? I’m guessing because you are already using 2.35.8 that you have all the requirements, but it might be helpful. Also, I see from the log that you are using Windows 10.

It might be a bug, who knows? The workaround could be to run a script deleting a column or two.

Hi @Gassim ,

Java version is 1.8.0_301
PostgreSQL version 13
Tomcat version 8.5.40
Windows 10

I have not created any SQL views yet.

Steps I took:

Steps I took:

I had a later version of DHIS2 running - 2.36.3 which was running perfectly, then I upgraded to 2.36.4, then things like maps, event reports, data exports in xls stopped working, so I decided to revert to an older version 2.35.8 - did a fresh installation of the instance and imported all the metadata and data from the old database. Now been trying to upgrade to 2.36.4, didn’t work because of the same error, tried upgrading to 2.37.0 - still got the same error.

A post was split to a new topic: Blank maps after upgrade

Okay thanks for all the info! Sharing this topic …

And so this one was working perfectly?

I asked for support, and @ameen referred me to the Jira issue: DHIS2-12222 | Upgrading instance from 2.35.8 to 2.36.4 fails with flyway error. So there is already an issue about this bug and the fix will be part of the next 2.36 and 2.37 patch versions.

Thanks @ckamb!

2 Likes

Yes, this one works fine with no major issues noted.

1 Like

@riyad had a similar issue trying to upgrade DHIS2 tracker instance from 2.35.8 to 2.36.4 and 2.36.5 but not sure if exact. any ideas, should we try an earlier version of 2.36.X ?

Message : ERROR: column psuga.programid does not exist
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.hisp.dhis.user.UserSettingService’ defined in URL [jar:file:/home/dhis2/tr-dev/webapps/tr-dev/WEB-INF/lib/dhis-service-core-2.36.5.jar!/org/hisp/dhis/user/DefaultUserSettingService.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.hisp.dhis.user.UserSettingStore’ defined in URL [jar:file:/home/dhis2/tr-dev/webapps/tr-dev/WEB-INF/lib/dhis-service-core-2.36.5.jar!/org/hisp/dhis/user/hibernate/HibernateUserSettingStore.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘flyway’ defined in class path resource [org/hisp/dhis/db/migration/config/FlywayConfig.class]: Invocation of init method failed; nested exception is org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException: SQL State : 42703
Error Code : 0

My suggestion is to actually try to upgrade to 2.37 in a test instance and this way you won’t face the bug issue above!

Update: thanks to Ameen, there’s a workaround: :arrow_down:

1 Like

There is a workaround for this if anybody needs it due to an emergency.

Rename the column “programstageid” in table “programstageusergroupaccesses” to “programid” and try deploying the 2.36 or 2.37 version after that.

ALTER TABLE programstageusergroupaccesses RENAME COLUMN programstageid to programid;
3 Likes

I had the same problem I renamed the column but still the same error.

Update:
Hi all!
The issue has been solved. DHIS2-12222 | Upgrading instance from 2.35.8 to 2.36.4 fails with flyway error has been marked as done by @Gintare :+1:


Welcome to the community @Saberi! :tada:

Interesting that you are still facing the same issue. Did you try to restart your instance as well as clear the bowser cache?

Thanks!

1 Like