Errors on upgrade from 2.37 to 2.40?

maybe,you should modify some code in the module of dhis-support-db-migration,dhis-support-external.
in dhis-support-db-migration:


in dhis-support-external:

then,delete the data of the table of version,delete the data in flyway_schema_history where success is f.
at last,repackage,redeploy.
good luck.