Bitbucket is not picking the correct schema to use for the database
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
Bitbucket won't start with the following errors:
1
2
3
4
5
6
2014-02-07 12:09:03,235 ERROR [http-bio-7990-exec-7] 728x27x0 jv58e6 10.123.16.180 "POST /setup HTTP/1.1" c.a.s.i.db.DefaultDatabaseManager Failed to obtain session factory
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryPrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing column: is_allow_all in CROWD.CWD_APP_DIR_MAPPING
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1512) ~[spring-beans-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1129) ~[spring-context-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at com.atlassian.stash.internal.db.DefaultDatabaseManager.createSessionFactory(DefaultDatabaseManager.java:337) [stash-service-impl-2.10.1.jar:na]
at com.atlassian.stash.internal.db.DefaultDatabaseManager.prepareDatabase(DefaultDatabaseManager.java:158) [stash-service-impl-2.10.1.jar:na]
1
2
2016-08-22 18:45:45,259 ERROR [spring-startup] c.a.j.s.w.s.JohnsonDispatcherServlet SpringMVC dispatcher [springMvc] could not be started
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sessionFactoryPrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing column: is_active in SCHEMA.CWD_APPLICATION
PostgreSQL database
1
2
3
4
ERROR [http-nio-7990-exec-1] <session_id> <user> <ip> "POST /setup HTTP/1.1" c.a.s.i.web.setup.SetupController An unexpected exception occurred while setting up the database
java.lang.RuntimeException: org.postgresql.util.PSQLException: ERROR: relation "databasechangeloglock" already exists
...
Caused by: org.postgresql.util.PSQLException: ERROR: relation "databasechangeloglock" already exists
Cause
Bitbucket server does not currently support the ability to specify which schema to use, therefore Bitbucket is not picking the correct schema to use for the database.
Resolution
Resolution 1
Set the Bitbucket server user to only have permission to the Bitbucket server schema.
Restart Bitbucket server and update the
bitbucket.properties
file with any database configuration changes.
Resolution 2
Move the Bitbucket server schema to it's own database.
Restart Bitbucket server and update the
bitbucket.properties
file with any database configuration changes.
Was this helpful?