Bitbucket Server fails to start - Missing column or missing table

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

The following appears in the atlassian-bitbucket.log when starting Bitbucket Server:

Caused by: org.hibernate.HibernateException: Missing column: slug in STASH.STASH_USER
    at org.hibernate.mapping.Table.validateColumns(Table.java:365) ~[hibernate-core-4.3.4.Final.jar:4.3.4.Final]
    at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1336) ~[hibernate-core-4.3.4.Final.jar:4.3.4.Final]
    at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155) ~[hibernate-core-4.3.4.Final.jar:4.3.4.Final]
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:525) ~[hibernate-core-4.3.4.Final.jar:4.3.4.Final]
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857) ~[hibernate-core-4.3.4.Final.jar:4.3.4.Final]
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1928) ~[hibernate-core-4.3.4.Final.jar:4.3.4.Final]
    at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:339) ~[spring-orm-4.0.0.RELEASE.jar:4.0.0.RELEASE]
    at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:427) ~[spring-orm-4.0.0.RELEASE.jar:4.0.0.RELEASE]
    at com.atlassian.bitbucket.internal.hibernate.ExtendedLocalSessionFactoryBean.buildSessionFactory(ExtendedLocalSessionFactoryBean.java:90) ~[bitbucket-dao-impl-2.11.4.jar:na]
    at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:412) ~[spring-orm-4.0.0.RELEASE.jar:4.0.0.RELEASE]
    ... 9 common frames omitted

Below are some additional entries we've seen related to this problem.


Caused by: org.hibernate.HibernateException: Missing column: remote_address_binary in public.cwd_application_address
 
Caused by: org.hibernate.HibernateException: Missing column: origin_id in public.repository

Caused by: org.hibernate.HibernateException: Missing table: sta_cmt_disc_comment_activity

Cause

There is a mismatch between the application version being used to start Bitbucket Server and the database. Most likely, a newer version of Bitbucket Server was started which was pointed at this database and ran the needed database upgrade tasks. This can result in various columns being dropped from the database. Alternatively, it's possible that an older version of Bitbucket Server has accidentally been started.

Resolution

If an older version of Bitbucket Server has accidentally be started, locate and start the newest version of Bitbucket Server installed on the server.

If the database was unintentionally upgraded to a newer version of Bitbucket Server, there are two paths forward:

  1. Restore a backup of both the filesystem and database according to Data recovery and backups to a time before the upgrade
  2. Perform the full upgrade to the latest version of Bitbucket Server that has been connected to the database

If you cannot get Bitbucket Server to start open a support request at https://support.atlassian.com and provide a dump of the databasechangelog table which Support will use to identify the correct version.

Last modified on Mar 18, 2018

Was this helpful?

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