Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bitbucket Server fails to start on upgrade springMVC dispatcher error

Christopher Gronde March 9, 2020

We are attempting to upgrade our Bitbucket server from 5.3.0 to 6.1.0.  Everytime we do we get the "SpringMVC dispatcher [springMvc] could not be started" screen in the browser.  Everything I have found is said to be database related so I created a new environment with a new fresh empty DB and connected it to 5.30 and it still breaks when upgrading to 6.1.0.

This is the error in the log:

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 'crowdAliasDao': Unsatisfied dependency expressed through method 'setSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sharedHomeLockAcquirer' defined in class path resource [stash-context.xml]: Cannot resolve reference to bean 'licenseHelper' while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'licenseHelper' defined in URL [jar:file:/apps/products/atlassian/bitbucket/6.10.1/app/WEB-INF/lib/bitbucket-service-impl-6.10.1.jar!/com/atlassian/stash/internal/license/DefaultLicenseHelper.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bootstrapLiquibase' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Cannot use default schema name dbo on Microsoft SQL Server because the login schema of the current user (db_owner) is different and MSSQL does not support setting the default schema per session.
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:676)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at java.lang.Thread.run(Thread.java:748)
... 18 frames trimmed
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sharedHomeLockAcquirer' defined in class path resource [stash-context.xml]: Cannot resolve reference to bean 'licenseHelper' while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'licenseHelper' defined in URL [jar:file:/apps/products/atlassian/bitbucket/6.10.1/app/WEB-INF/lib/bitbucket-service-impl-6.10.1.jar!/com/atlassian/stash/internal/license/DefaultLicenseHelper.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bootstrapLiquibase' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Cannot use default schema name dbo on Microsoft SQL Server because the login schema of the current user (db_owner) is different and MSSQL does not support setting the default schema per session.
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:314)
... 5 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'licenseHelper' defined in URL [jar:file:/apps/products/atlassian/bitbucket/6.10.1/app/WEB-INF/lib/bitbucket-service-impl-6.10.1.jar!/com/atlassian/stash/internal/license/DefaultLicenseHelper.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bootstrapLiquibase' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Cannot use default schema name dbo on Microsoft SQL Server because the login schema of the current user (db_owner) is different and MSSQL does not support setting the default schema per session.
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:769)
... 5 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bootstrapLiquibase' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Cannot use default schema name dbo on Microsoft SQL Server because the login schema of the current user (db_owner) is different and MSSQL does not support setting the default schema per session.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1778)
... 5 common frames omitted
Caused by: java.lang.RuntimeException: Cannot use default schema name dbo on Microsoft SQL Server because the login schema of the current user (db_owner) is different and MSSQL does not support setting the default schema per session.
at liquibase.database.core.MSSQLDatabase.setDefaultSchemaName(MSSQLDatabase.java:118)
at liquibase.database.ExtendedSpringLiquibase.createDatabase(ExtendedSpringLiquibase.java:51)
at liquibase.integration.spring.SpringLiquibase.createLiquibase(SpringLiquibase.java:324)
at liquibase.database.ExtendedSpringLiquibase.afterPropertiesSet(ExtendedSpringLiquibase.java:32)
... 5 common frames omitted

2 answers

0 votes
Nate Hansberry
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 20, 2020

Hi Everyone!

The above issue can be fixed by changing the default schema of the bitbucket user to dbo instead of db_owner.

This can be done in the MSSQL GUI or via SQL statement (see MSSQL Documentation).

In addition to researching this subject I was able to run a test. Based on the results I am unable to conclude that upgrading Bitbucket Server from 5.X to 6.10.1 will lead to this issue.

 

Test Outline:

  • spin up a mssql db
     
    Microsoft SQL Server
    12.00.5000
    jTDS Type 4 JDBC Driver for MS SQL Server and Sybase
    1.3.1
    
  • connect bbs 5.3.0 to the mssql db
  • query default schema of bitbucketuser -> default schema is dbo
  • upgrade bbs to 6.10.1
  • query default schema of bitbucketuser -> default schema is still dbo

Summary of items that seem to prevent correlation:

  • Our documentation doesn't mention any SQL statement that creates a relationship between the bitbucketuser and the db_owner or the dbo schema; This appears to be handled by MSSQL
  • The default schema did not change as a result of an upgrade during the test

 

I hope this information is helpful!

 

Nate Hansberry

Atlassian Developer Tools Support

0 votes
Kurt Klinner
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 9, 2020

@Christopher Gronde 

 

Hi Christopher

 

based on

 Cannot use default schema name dbo on Microsoft SQL Server because the login schema of the current user (db_owner) is different and MSSQL does not support setting the default schema per session.

 

How are the permissions set for the database that you use and especially for the user that you use?

https://confluence.atlassian.com/bitbucketserver/connecting-bitbucket-server-to-sql-server-776640385.html lists all the needed configs.

Cheers

Kurt

Christopher Gronde March 10, 2020

Kurt,

I verified with our DBA that everything is set up correctly as per this document.  He even sent me a screenshot showing me that the user is in the db_owner role as per the document.  I am still getting the same error.  This worked in 5.3 just fine.  I wasn't until we tried upgrade to 6.10.1 that this became an issue.  

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events