Unable to upgrade from version 1.6.6 to version 2.8.0
Symptoms
The following errors are logged while attempting to upgrade the database:
Error creating bean with name 'dbControlFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.cenqua.crucible.hibernate.DBControlFactoryImpl]: Constructor threw exception; nested exception is com.cenqua.crucible.hibernate.CruDBException: Problem upgrading with script /opt/fecru-upgrade/fecru-2.8.0/sql/HSQL/upgrade/upgrade_30.sql: SQL script error on line 290: "alter table cru_frx add constraint FK3E2EDB53D70B78C3 foreign key (cru_file_revision) references cru_revision;"
(Integrity constraint violation - no parent 74068, table: CRU_FRX in statement [alter table cru_frx add constraint FK3E2EDB53D70B78C3 foreign key (cru_file_revision) references cru_revision])
[……]
Cause
The upgrade is failing because of an "Integrity constraint violation" of type FK3E2EDB53D70B78C3 for the table cru_frx:
Caused by: java.sql.SQLException: Integrity constraint violation - no parent 74068, table: CRU_FRX in statement [alter table cru_frx add constraint FK3E2EDB53D70B78C3 foreign key (cru_file_revision) references cru_revision]
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.jdbcStatement.executeUpdate(Unknown Source)
at com.cenqua.crucible.hibernate.DefaultDBControl.executeScript(DefaultDBControl.java:455)
Workaround
1. Make a backup of the Fisheye/Crucible 1.6.6 instance (7. Backing Up and Restoring Config Data)
2. Install a clean Fisheye/Crucible 2.8.0 on your test server but DO NOT yet start the application.
3. Define a FISHEYE_INST
environment variable and point it to an empty directory.
4. Unzip the 1.6.6 backup Zip file in FISHEYE_INST
.
5. Download and save the attached 'patchgeneric.sql'.
6. From the directory containing the 'patchgeneric.sql' file, run the following from the command-line taking care to change the paths accordingly:
java -Xmx2048m -jar <FishEye home directory>/lib/hsqldb-1.8.0.10.jar --inlineRC "URL=jdbc:hsqldb:file:<FISHEYE_INST>/var/data/crudb/crucible;shutdown=true,USER=sa,PASSWORD=" patchgeneric.sql
7. Start the application.
Related
patchgeneric.sql Fails to Help Upgrading Fisheye from Version 1.6.6 to Version 2.8.0