Bitbucket is not picking the correct schema to use for the database

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

Bitbucket won't start with the following errors:

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] 
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

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.

  BSERV-3540 - Getting issue details... STATUS

Resolution

Resolution 1

  1. Set the Bitbucket server user to only have permission to the Bitbucket server schema.
  2. Restart Bitbucket server and update the bitbucket.properties file with any database configuration changes.

Resolution 2

  1. Move the Bitbucket server schema to it's own database.
  2. Restart Bitbucket server and update the bitbucket.properties file with any database configuration changes.

 

Last modified on May 26, 2017

Was this helpful?

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