deployment problems - Initialization failed for Singleton StartupFlywayMigrator

68 views
Skip to first unread message

Jacek Chudzik

unread,
Apr 20, 2023, 11:29:08 AM4/20/23
to Dataverse Users Community
Hello,

I was trying to upgrade Dataverse 5.12.1 into 5.13.
Command asadmin deploy dataverse-5.13.war ended with process failed

remote failure: Error occurred during deployment: Exception while loading the app : javax.ejb.CreateException: Initialization failed for Singleton StartupFlywayMigrator.

I removed generadted and osgi-cache folders but the problem remains.

Do you have any idea how to solve this problem?

Regards,
Jacek Chudzik

James Myers

unread,
Apr 20, 2023, 12:35:13 PM4/20/23
to dataverse...@googlegroups.com

Jacek,

You shouldn’t see this with the official releases. If you did, please submit a bug. The underlying error is related to how Dataverse applies sql update scripts using Flyway. Two scripts with the same number will conflict.  https://guides.dataverse.org/en/latest/developers/sql-upgrade-scripts.html?highlight=flyway has details and the last section there describes how to resolve your problem.

 

- Jim

--
You received this message because you are subscribed to the Google Groups "Dataverse Users Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dataverse-commu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dataverse-community/7e9381d4-ca19-4b02-96d0-bcc5e794380bn%40googlegroups.com.

Jacek Chudzik

unread,
Apr 21, 2023, 5:55:19 AM4/21/23
to Dataverse Users Community
Thank you Jim for reply.


Unfortunately truncate on table flyway_schema_history didn't help. I still get the same remote failure message during deploy.

In server.log there is another information:

org.flywaydb.core.api.FlywayException: Unable to find resource on disk: db/migration/V4.13.0.1__3575-usernames.sql

which is strange, because db/migration files are created during the deploy.

I can report a bug on https://github.com/IQSS/dataverse/issues but at this moment I'm stuck. I can deploy 5.12.1 but I'm unable to upgrade to 5.13.


Jacek

James Myers

unread,
Apr 21, 2023, 8:33:27 AM4/21/23
to dataverse...@googlegroups.com

Hmm – if the file is there, all I can think of would be a permissions issue, but why that would apply to only one file, I don’t know.

 

One thing to clarify w.r.t. the debugging instructions: you should not truncate the table, just delete the row(s) for the recent/conflicting files. In general, the scripts have been idempotent – able to be rerun on the same database without issue, but I think some were not (although I don’t have a specific example.)

 

-- Jim

Jacek Chudzik

unread,
Apr 21, 2023, 9:13:20 AM4/21/23
to Dataverse Users Community
File is not there before deployment, and - I guess - never is.
Permissions are checked. I got second installation of Datavers, which works fine, and was upgraded only with warnings (which is normal).
I did truncate on table as there were only records from one installation. 5.12.1 was set few months ago from a scratch. If I should delete particular file than please let me know which.

Jacek

James Myers

unread,
Apr 21, 2023, 9:40:02 AM4/21/23
to dataverse...@googlegroups.com

Jacek,

 

I don’t have good suggestions for you as I don’t understand why your install is failing. The Flyway scripts are in the war file and you should see them inside the exploded war file at the relative path ./WEB-INF/classes/db/migration. In my local install I see a 111 byte V4.13.0.1__3575-usernames.sql there along with all the other scripts.

For you to get an “Unable to find resource on disk: db/migration/V4.13.0.1__3575-usernames.sql” error, I can only guess that the file isn’t at the path above or that the permissions for the operating system user account running payara/dataverse don’t allow it to read that file. If that’s not it, I don’t know what else could cause this specific issue.

The one known scenario where we see flyway issues is where a developer has been installing multiple branches. If I’ve been working on code that would require a V5.14.0.1-my-work.sql file and I then I work on another branch where another developer has created V5.14.0.1-their-work.sql, when I try to install flyway will fail because the V5.14.0.1 script has changed. Deleting that last row from the flyway table allows it to install V5.14.0.1-their-work.sql correctly and I can then create a V5.14.0.2 file to keep developing.

 

With the releases, we make sure such changes don’t occur so there should never be cases where you get a flyway error going from v12.1 to v13.

With a truncated table, I could imagine you could now get other errors (if reapplying one of the scripts gives an error because it isn’t idempotent), so I would definitely check to make sure you’re still stuck with the “Unable to find resource on disk” error and not something new. If you get something new, I’d suggest either restoring from a backup database or replacing the flyway table from a backup or another successful v12.1 install (**this is only an option if/when you are sure that all of the listed flyway scripts were actually applied to your postgres db in the past. If they were not, you will have a db missing changes/constraints**).

Another thought – since Flyway is a standard component, you may be able to find something else on the web about how/when those Unable to find resource on disk errors can occur.

I hope some of that helps,

--Jim

Jacek Chudzik

unread,
Sep 5, 2023, 7:37:53 AM9/5/23
to Dataverse Users Community
Dear Jim,

just want to let you know that I did have the same problem once again and solution that worked was - as you said - delete the row(s) for the recent/conflicting files in flyway_schema_history.

Regards,
Jacek
Reply all
Reply to author
Forward
0 new messages