Upgrade Fails: Problem upgrading with script, Violation of unique constraint on upgrade_33.sql

Still need help?

The Atlassian Community is here for you.

Ask the community


Upgrading from Fisheye/Crucible version 1.6.X to 2.X fails with an error similar to the following:

Caused by: 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 /data/apps/fecru-2.0.0/sql/HSQL/upgrade/upgrade_33.sql: SQL script error on line 54: 
"insert into cru_inline_comment (select distinct(cru_comment), cru_frx_id from cru_revision_comment where cru_line_range is not null);" 
(Violation of unique constraint SYS_PK_649: duplicate value(s) for column(s) CRU_COMMENT_ID), 
please contact http://www.atlassian.com/support/


Corruptions in the database, duplicate entries, prevent the upgrade script from completing successfully.


  1. Connect to the HSQL DB using this connection procedure.
  2. Run the following SQL queries:
    1. select comment from revision_comment where linerange is null group by comment having count(comment) > 1;
      1. The result will be an ID number, for example: 22
    2. select * from revision_comment where comment=22;
      1. The result will will be the offending data, for example:


19 2008-12-0812:06:23(null)126104022

3. Either run the following SQL command (don't forget to commit the change):

delete from revision_comment where rc_id = 19;



Create the SQL script and apply it directly from the command line:


delete from revision_comment where rc_id = 19;
  1. Go to Administration > Backup and create a backup of the db in your crucible 1.6.6.
  2. Shutdown the Fisheye/Crucible server.
  3. Go to the FISHEYE_HOME/lib directory and run the following command, replacing FISHEYE_HOME and FISHEYE_INST with the fully qualified path:


java -Xms512m -Xmx512m -jar FISHEYE_HOME/lib/hsqldb- --inlineRC "URL=jdbc:hsqldb:file:FISHEYE_INST/var/data/crudb/crucible;shutdown=true,USER=sa,PASSWORD=" patch.sql

4. The above command should result in output similar to the following:

x rows updated (where x is some number > 0)

Last modified on Jul 31, 2018

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.