Task #1013
closed
Application startup fails due to Flyway bug
Added by Alena Peterová almost 7 years ago.
Updated over 4 years ago.
Description
Affected version: 7.8.3 when updated from 7.8.2
Tomcat server fails to start with the following exception:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayCore' defined in class path resource [eu/bcvsolutions/idm/core/config/flyway/CoreFlywayConfig.class]:
Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: Comparison method violates its general contract!
As Ondra advised, this is probably a bug in Flyway and can be resolved by adding -Djava.util.Arrays.useLegacyMergeSort=true to JAVA_OPTS.
If there is no other solution, please add this information to the release notes for 7.8.3 and to the guide for installation CzechIdM.
The same behaviour for Windows when upgraded from 7.8.1 to 7.8.3.
Java version: Oracle JDK 1.8.0_152
Resolved by adding -Djava.util.Arrays.useLegacyMergeSort=true to Tomcat configuration (C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin\Tomcat8w.exe)
- Priority changed from Normal to High
- Priority changed from High to Normal
- % Done changed from 0 to 10
Note: After all the flyway scripts were executed, I can start the application correctly without that added Java option. It looks like the problem exists only when the flyway script is applied during the first startup (after upgrade).
Since the problem didn't occur during previous upgrades, there could be some connection with the name/numbering of the 2 scripts added in the version 7.8.3.
I see it now:
...
V7_08_003__add-login-count-and-date-nullable.sql
V8_00_004__eav-short-text-type-indexes.sql
...
This could make this problems, i overlooked it.
- % Done changed from 10 to 50
I've added missing scripts V8_00_001 - V8_00_003 (just empty files). Files are ignored when installed version is higher than 7.8.0 (=> V8_00_004 and higher is applied), but this should help for future versions, when app is installed.
- Status changed from New to In Progress
I checked this behavior on my local clean environment without setting property: -Djava.util.Arrays.useLegacyMergeSort=true and also on clean installation windows server 2016 and both cases works well! Thank you.
This ticket can be probably closed.
Yesterday I try upgrade docker image with IdM in version 7.7.0 and I received same error as above Comparison method violates its general contract! with property useLegacyMergeSort IdM starts correctly :(
New script into versio 8 was added (V8_00_007), else script were aplied -> and now startup fails on my machine too, it's strange. So adding missing scripts didn't help.
- Status changed from In Progress to New
Where to add -Djava.util.Arrays.useLegacyMergeSort=true (= where is JAVA_OPTS in our standard installation):
CentOS:
/etc/systemd/system/tomcat.service
Debian:
/etc/default/tomcat8
Windows:
C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin\Tomcat8w.exe
- Related to Task #2167: Remove "useLegacyMergeSort=true" from Tomcat unit configuration added
- Status changed from New to Closed
- Target version set to 10.4.0
- % Done changed from 50 to 100
This issue not occus after Flyway was updated in CzechIdM version 10.x.
Also available in: Atom
PDF