New Bamboo Installation - Could Not Generate Next Build Number
Asked by Gambit ID INC:

I just installed and configured a new self-hosted instance of Bamboo. When I invoke a build plan through the user interface, I get an error starting that the next build number could not be generated. Is there a fix for this?

Here is the stacktrace. Note that I needed to remove part of it do to the character limit. The missing part is noted by \<LINES OMITTED HERE\>:

```
java.lang.RuntimeException: Could not generate next build number for 'XXX-YYY'
 at com.atlassian.bamboo.build.BuildNumberGeneratorServiceImpl.generateBuildNumber(BuildNumberGeneratorServiceImpl.java:29)
 at com.atlassian.bamboo.v2.trigger.ManualBuildDetectionAction.generateResultWithoutChanges(ManualBuildDetectionAction.java:96)
 at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$3.createBuildDetectionResult(ChainExecutionManagerImpl.java:462)
 at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.createNewChainState(ChainExecutionManagerImpl.java:502)
 at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.createChainStateNoDetection(ChainExecutionManagerImpl.java:459)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:483)
 at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
 at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
 at com.sun.proxy.$Proxy198.createChainStateNoDetection(Unknown Source)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:483)
 at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
 at com.sun.proxy.$Proxy198.createChainStateNoDetection(Unknown Source)
 at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1.call(PlanExecutionManagerImpl.java:355)
 at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1.call(PlanExecutionManagerImpl.java:346)
 at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:293)
 at com.atlassian.bamboo.plan.PlanExecutionLockServiceImpl.inlineProcessLocks(PlanExecutionLockServiceImpl.java:89)
 at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.doWithInlineProcessLock(PlanExecutionManagerImpl.java:623)
 at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.startManualBuild(PlanExecutionManagerImpl.java:346)
 at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.start(PlanExecutionManagerImpl.java:483)
 at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.lambda$startManualExecution$0(PlanExecutionManagerImpl.java:268)
 at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$$Lambda$500/644719818.call(Unknown Source)
 at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:162)
 at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.startManualExecution(PlanExecutionManagerImpl.java:270)
 at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.startManualExecution(PlanExecutionManagerImpl.java:219)
 at com.atlassian.bamboo.plan.DelegatingPlanExecutionManager.startManualExecution(DelegatingPlanExecutionManager.java:116)
 at com.atlassian.bamboo.v2.ww2.build.TriggerManualBuild.execute(TriggerManualBuild.java:44)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:483)
 at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:899)
 at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1544)
 at ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68)
 at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:96)
 at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:88)
 at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1620)
 at ognl.ASTMethod.getValueBody(ASTMethod.java:91)
 at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
 at ognl.SimpleNode.getValue(SimpleNode.java:258)
 at ognl.Ognl.getValue(Ognl.java:470)
 at ognl.Ognl.getValue(Ognl.java:434)
 at com.opensymphony.xwork2.ognl.OgnlUtil$3.execute(OgnlUtil.java:371)
 at com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecuteMethod(OgnlUtil.java:423)
<LINES OMITTED HERE>
Caused by: java.lang.IllegalStateException: No build numbers record for plan JEM-POM
 at com.google.common.base.Preconditions.checkState(Preconditions.java:173)
 at com.atlassian.bamboo.build.BuildNumberGeneratorDaoImpl.generateBuildNumberNewTx(BuildNumberGeneratorDaoImpl.java:22)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:483)
 at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
 at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
 at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
 at com.sun.proxy.$Proxy263.generateBuildNumberNewTx(Unknown Source)
 at com.atlassian.bamboo.build.BuildNumberGeneratorServiceImpl.lambda$generateBuildNumber$0(BuildNumberGeneratorServiceImpl.java:26)
 at com.atlassian.bamboo.build.BuildNumberGeneratorServiceImpl$$Lambda$501/1831167571.call(Unknown Source)
 at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:293)
 at com.atlassian.bamboo.build.BuildNumberGeneratorServiceImpl.generateBuildNumber(BuildNumberGeneratorServiceImpl.java:
```


Answers:
author: Christian Glockner
body: Hi Kathryn,

This error typically occurs if the **BUILD_NUMBERS** table doesn't exist in the database or if it is in the wrong schema (this usually can happen on SQL Server), so I'd look at the database to ensure the table exists and is in the same schema as all the other tables.

Cheers,

Christian

Premier Support Engineer

Atlassian

comments: author: Carsten Hilber
body: Hi, I'm running into the same problem.

Just upgraded to 6.4.1. The old builds are fine.

I copied a new build and it cannot be started. exact same error as above.

Database table is there, and in the right scheme.

Any hint on how to fix this?

Thanks

Carsten