Can't get past Database setup for Bamboo setup
Asked by Eazie Enibe:

Hi Support,

For some reason, i can't get past "Setting up database for Bamboo" the loader keeps showing unending. When i refresh it throws 500 server error.

Until i restart the bamboo service then it goes back to set up database screen.


Answers:
author: Eazie Enibe
body: If using SQL SERVER, make sure your database has the correct collation type (SQL_Latin1_General_CP1_CS_AS) for bamboo database and configure database to use correct isolation level, you can use this:

ALTER DATABASE \<database name\>

SET READ_COMMITTED_SNAPSHOT ON

WITH ROLLBACK IMMEDIATE;

This resolved my issue.

comments: author: cfbtel
body: 1. Kill all the processes using Bamboo
2. Delete the bamboo-home folder
3. drop the database bamboo
4. Restart bamboo to get the home folder rebuilt

If using SQL SERVER, make sure your database has the correct collation type (SQL_Latin1_General_CP1_CS_AS) for bamboo database and configure database to use correct isolation level, you can use this:

ALTER DATABASE \<database name\>

SET READ_COMMITTED_SNAPSHOT ON

WITH ROLLBACK IMMEDIATE;


author: somethingblue
body: Hi Eazie,  

When you get the 500 error what do you see in the `atlassian-bamboo.log around the time the Database connection attempt throws the 500 error?`  

`Please provide a snippet here and we'll go from there. `  

Cheers,  

Branden

comments: author: Eazie Enibe
body: Hi Branden,

Below is the exception snippet from the atlassian-bamboo.log

at java.lang.Thread.run(Unknown Source)  
2018-01-23 19:34:39,643 ERROR \[setupEmbeddedDatabaseBackgroundThread\] \[MetadataContext\] HHH015007: Illegal argument on static metamodel field injection : com.atlassian.bamboo.agent.elastic.server.ElasticImageConfigurationImpl_#subnetIds; expected type : org.hibernate.metamodel.internal.SingularAttributeImpl; encountered type : javax.persistence.metamodel.CollectionAttribute  
2018-01-23 19:34:39,644 ERROR \[setupEmbeddedDatabaseBackgroundThread\] \[MetadataContext\] HHH015007: Illegal argument on static metamodel field injection : com.atlassian.bamboo.agent.elastic.server.ElasticImageConfigurationImpl_#availabilityZones; expected type : org.hibernate.metamodel.internal.SingularAttributeImpl; encountered type : javax.persistence.metamodel.CollectionAttribute  
2018-01-23 19:34:39,651 ERROR \[setupEmbeddedDatabaseBackgroundThread\] \[MetadataContext\] HHH015007: Illegal argument on static metamodel field injection : com.atlassian.bamboo.project.DefaultProject_#allPlans; expected type : org.hibernate.metamodel.internal.PluralAttributeImpl$CollectionAttributeImpl; encountered type : javax.persistence.metamodel.ListAttribute  
2018-01-23 19:34:41,885 WARN \[setupEmbeddedDatabaseBackgroundThread\] \[LuceneConnection\] Forcing unlock of locked index directory: org.apache.lucene.store.MMapDirectory@C:\\Users\\Administrator\\bamboo-home\\index\\results lockFactory=org.apache.lucene.store.NativeFSLockFactory@5bb817d6  
2018-01-23 19:34:41,887 WARN \[setupEmbeddedDatabaseBackgroundThread\] \[DefaultListableBeanFactory\] Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'planStatePersister' defined in class path resource \[applicationContextManagers.xml\]: Cannot create inner bean 'com.atlassian.bamboo.plan.PlanStatePersisterImpl#78cd74b7' of type \[com.atlassian.bamboo.plan.PlanStatePersisterImpl\] while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.atlassian.bamboo.plan.PlanStatePersisterImpl#78cd74b7' defined in class path resource \[applicationContextManagers.xml\]: Cannot resolve reference to bean 'buildResultsIndexer' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'buildResultsIndexer' defined in class path resource \[applicationContextManagers.xml\]: Cannot create inner bean 'com.atlassian.bamboo.index.buildresult.DefaultBuildResultsIndexer#385b5f8' of type \[com.atlassian.bamboo.index.buildresult.DefaultBuildResultsIndexer\] while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.atlassian.bamboo.index.buildresult.DefaultBuildResultsIndexer#385b5f8' defined in class path resource \[applicationContextManagers.xml\]: Cannot resolve reference to bean 'buildResultLuceneConnection' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'buildResultLuceneConnection' defined in class path resource \[applicationContextManagers.xml\]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate \[com.atlassian.bamboo.index.LuceneConnectionImpl\]: Constructor threw exception; nested exception is com.atlassian.bonnie.LuceneException: org.apache.lucene.store.LockReleaseFailedException: Cannot forcefully unlock a NativeFSLock which is held by another indexer component: C:\\Users\\Administrator\\bamboo-home\\index\\results\\write.lock  
2018-01-23 19:34:42,022 INFO \[setupEmbeddedDatabaseBackgroundThread\] \[BrokerService\] Using Persistence Adapter: KahaDBPersistenceAdapter\[C:\\Users\\Administrator\\bamboo-home\\jms-store\\bamboo\\KahaDB\]  
2018-01-23 19:34:42,023 INFO \[setupEmbeddedDatabaseBackgroundThread\] \[SharedFileLocker\] Database C:\\Users\\Administrator\\bamboo-home\\jms-store\\bamboo\\KahaDB\\lock is locked by another server. This broker is now in slave mode waiting a lock to be acquired  
2018-01-23 23:41:56,490 ERROR \[http-apr-8085-exec-17\] \[FiveOhOh\] 500 Exception was thrown.  
java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?  
at org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:83)  
at org.springframework.orm.hibernate5.support.OpenSessionInViewFilter.lookupSessionFactory(OpenSessionInViewFilter.java:189)  
at org.springframework.orm.hibernate5.support.OpenSessionInViewFilter.lookupSessionFactory(OpenSessionInViewFilter.java:175)  
at org.springframework.orm.hibernate5.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:126)  
at com.atlassian.bamboo.persistence.BambooSessionInViewFilter.doFilterInternal(BambooSessionInViewFilter.java:24)  
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.bamboo.filter.BambooCompressingFilter.doFilter(BambooCompressingFilter.java:39)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.bamboo.filter.RequestCacheThreadLocalFilter.doFilter(RequestCacheThreadLocalFilter.java:40)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.bamboo.filter.ClickjackingAndMimeTypeSniffingPreventionFilter.doFilter(ClickjackingAndMimeTypeSniffingPreventionFilter.java:36)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.bamboo.filter.CookieCacheControlFilter.doFilter(CookieCacheControlFilter.java:49)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.core.filters.HeaderSanitisingFilter.doFilter(HeaderSanitisingFilter.java:44)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:64)  
at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:58)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)  
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)  
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)  
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)  
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)  
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)  
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)  
at org.apache.catalina.valves.StuckThreadDetectionValve.invoke(StuckThreadDetectionValve.java:206)  
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)  
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)  
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)  
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670)  
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2508)  
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2497)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)  
at java.lang.Thread.run(Unknown Source)  
2018-01-23 23:41:56,583 INFO \[http-apr-8085-exec-19\] \[JohnsonFilter\] The application is not yet setup. Redirecting request from '/favicon.ico' to '/bootstrap/selectSetupStep.action'  
2018-01-23 23:41:56,590 ERROR \[http-apr-8085-exec-20\] \[FiveOhOh\] 500 Exception was thrown.  
java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?  
at org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:83)  
at org.springframework.orm.hibernate5.support.OpenSessionInViewFilter.lookupSessionFactory(OpenSessionInViewFilter.java:189)  
at org.springframework.orm.hibernate5.support.OpenSessionInViewFilter.lookupSessionFactory(OpenSessionInViewFilter.java:175)  
at org.springframework.orm.hibernate5.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:126)  
at com.atlassian.bamboo.persistence.BambooSessionInViewFilter.doFilterInternal(BambooSessionInViewFilter.java:24)  
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.bamboo.filter.BambooCompressingFilter.doFilter(BambooCompressingFilter.java:39)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.bamboo.filter.RequestCacheThreadLocalFilter.doFilter(RequestCacheThreadLocalFilter.java:40)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.bamboo.filter.ClickjackingAndMimeTypeSniffingPreventionFilter.doFilter(ClickjackingAndMimeTypeSniffingPreventionFilter.java:36)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.bamboo.filter.CookieCacheControlFilter.doFilter(CookieCacheControlFilter.java:49)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.core.filters.HeaderSanitisingFilter.doFilter(HeaderSanitisingFilter.java:44)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:64)  
at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:58)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)  
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)  
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)  
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)  
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)  
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)  
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)  
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)  
at org.apache.catalina.valves.StuckThreadDetectionValve.invoke(StuckThreadDetectionValve.java:206)  
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)  
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)  
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)  
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670)  
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2508)  
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2497)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)  
at java.lang.Thread.run(Unknown Source)


author: somethingblue
body: Hi Eazie,

I've seen this before and the issue was a .lock file in the bamboo-home. To resolve this:

1. Kill all the processes using Bamboo (including the Apache Common process hosting the bamboo service
2. Delete the bamboo-home folder
3. Restart bamboo to get the home folder rebuilt

Let me know if that works for you and we'll go from there.

Cheers,

Branden


author: Eazie Enibe
body: Hi Branden,

I've tried this and it works but i face the initial problem that led to this again, when i select custom setup for bamboo, i selected to use external database which is SQL Server, i created a database "bamboo", provided the correct collation and rights.

When i configure the SQL Server for bamboo and submit, it loads for a while and return to same page without proceeding to the next step. But the tables are already created in the SQL Server table.

I want to know why it keeps returning to the configure external database page even when all tables are created.

Regards,

Eazie.


author: Maitri
body: Hi Eazie,

Have been able to resolve this issue? I am having the exact same issue while setting up Bamboo, it would be of much helpful if you can share the solution if you have already resolved?


author: Derrick Slopey
body: Here's an apparent solution that worked for some people:  
<https://community.atlassian.com/t5/Answers-Developer-Questions/Bamboo-stuck-at-setting-up-database/qaq-p/568003#M105662>  

Didn't work for me.


author: Jamshaid Ishaq
body: I have done all the setups but issue persist.

1. Kill all the processes using Bamboo
2. Delete the bamboo-home folder
3. drop the database bamboo
4. Restart bamboo to get the home folder rebuilt