What might cause "A fatal error has occured... SpringMVC dispatcher [springMvc] could not be started
Asked by Jeff Marmash:

Currently running Bitbucket server 6.4. Our installation has been running just fine for about a couple of years. Today, out of the blue it seems, the server will not start. I've read many similar posts but cannot seem to find anything explainnig the errors below. Can someone please assist?

Thanks,

Jeff

. ____ _ __ _ _  
/\\\\ / ___'_ __ _ _(_)_ __ __ _ \\ \\ \\ \\  
( ( )\\___ \| '_ \| '_\| \| '_ \\/ _\` \| \\ \\ \\ \\  
\\\\/ ___)\| \|_)\| \| \| \| \| \|\| (_\| \| ) ) ) )  
' \|____\| .__\|_\| \|_\|_\| \|_\\__, \| / / / /  
=========\|_\|==============\|___/=/_/_/_/  
:: Spring Boot :: (v2.1.3.RELEASE)

<br />

2021-10-18 15:41:21,088 INFO \[main\] c.a.b.i.b.BitbucketServerApplication Starting BitbucketServerApplication on with (C:\\Atlassian\\Bitbucket\\6.4.0\\app\\WEB-INF\\classes started by in C:\\Atlassian\\Bitbucket\\6.4.0\\app)  
2021-10-18 15:41:21,088 INFO \[main\] c.a.b.i.b.BitbucketServerApplication The following profiles are active: windows  
2021-10-18 15:41:22,228 INFO \[main\] c.a.b.i.boot.log.BuildInfoLogger Starting Bitbucket 6.4.0 (31a17cd built on Mon Jun 17 01:06:41 EDT 2019)  
2021-10-18 15:41:22,228 INFO \[main\] c.a.b.i.boot.log.BuildInfoLogger JVM: Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 1.8.0_172-b11  
2021-10-18 15:41:24,306 INFO \[main\] c.a.b.i.b.BitbucketServerApplication Started BitbucketServerApplication in 4.843 seconds (JVM running for 7.465)  
2021-10-18 15:41:29,041 INFO \[spring-startup\] c.a.s.internal.home.HomeLockAcquirer Successfully acquired lock on home directory C:\\Atlassian\\ApplicationData\\Bitbucket  
2021-10-18 15:41:33,119 WARN \[spring-startup\] o.s.w.c.s.XmlWebApplicationContext Exception encountered during context initialization - cancelling refresh attempt: 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:/C:/Atlassian/Bitbucket/6.4.0/app/WEB-INF/lib/bitbucket-service-impl-6.4.0.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.  
2021-10-18 15:41:33,134 INFO \[spring-startup\] c.a.s.internal.home.HomeLockAcquirer Releasing lock on C:\\Atlassian\\ApplicationData\\Bitbucket  
2021-10-18 15:41:33,134 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:/C:/Atlassian/Bitbucket/6.4.0/app/WEB-INF/lib/bitbucket-service-impl-6.4.0.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 trimmef  
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:/C:/Atlassian/Bitbucket/6.4.0/app/WEB-INF/lib/bitbucket-service-impl-6.4.0.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:378)  
... 5 common frames omitted  
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'licenseHelper' defined in URL \[jar:file:/C:/Atlassian/Bitbucket/6.4.0/app/WEB-INF/lib/bitbucket-service-impl-6.4.0.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:1762)  
... 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


Answers:
author: Christian Glockner
body: Hi Jeff,

Here's the underlying error:

**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.**

I suggest you take a look at <https://confluence.atlassian.com/bitbucketserver/connect-bitbucket-to-sql-server-776640385.html> to verify you've configured the database as required for SQL Server.

Cheers,

Christian

Premier Support Engineer

Atlassian

comments: author: Jeff Marmash
body: Thanks for the confirmation Christian. This installation has been running, without issue, for well over a year. I'm thinking something related to the SQL Server configuration changed without our knowledge. After reviewing the information in the link provided, I'm still unclear as to where I can change/view the current MSSQL config. Keep in mind that I am unable to start the admin site with same error originally noted.  

Can you provide any further steps to possibly resolve this? Can the schema/db changes be made in configs outside of the admin site? Is a reinstall required?  

Thanks,

Jeff


author: Jeff Marmash
body: UPDATE:  

I've resolved the issue. It appears that someone or something changed the default schema in our database for the Bitbucket SQL User. The value was "db_owner" and after switching the user to "dbo" and restarting the Bitbucket services, all related tools began working again.  

Thanks for the assist Christian.


Tags: bitbucket-server

server