Error upgrading Teamcity 4.5.1 to Teamcity 5.1.2

Hello,

We are having issues upgrading our existing TC to 5.1.2. This is the error message we are getting on first initialisation.

Error creating bean with name 'standardBuildProblems' defined in URL [jar:file:/C:/TeamCity/webapps/ROOT/WEB-INF/lib/server.jar!/META-INF/buildServerSpring.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [jetbrains.buildServer.ExtensionHolder]: : Error creating bean with name 'databaseConverter' defined in URL [jar:file:/C:/TeamCity/webapps/ROOT/WEB-INF/lib/server.jar!/META-INF/buildServerSpring.xml]: Invocation of init method failed; nested exception is jetbrains.buildServer.serverSide.versioning.ConvertException: Converter jetbrains.buildServer.serverSide.versioning.VersionManager$64 failed with error: SQL error when doing: Execute DDL
SQL query: alter table action_history alter column object_id varchar(80) null
SQL exception: The index 'action_history_object' is dependent on column 'object_id'.; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'databaseConverter' defined in URL [jar:file:/C:/TeamCity/webapps/ROOT/WEB-INF/lib/server.jar!/META-INF/buildServerSpring.xml]: Invocation of init method failed; nested exception is jetbrains.buildServer.serverSide.versioning.ConvertException: Converter jetbrains.buildServer.serverSide.versioning.VersionManager$64 failed with error: SQL error when doing: Execute DDL
SQL query: alter table action_history alter column object_id varchar(80) null
SQL exception: The index 'action_history_object' is dependent on column 'object_id'.


teamcity-server.log is attached, I suspect this is where it went ugly.

INFO - Side.versioning.VersionManager - Start applying converter Enlarge 'object_id' column size in audit tables to be able to store role ids. (358)



Is there a workaround to this? Thanks.


Attachment(s):
teamcity-server.log.zip
5 comments

Hello Lukman,

which version of MS SQL do you use?

Thanks,
Leonid

0

Hello,

The old TC was using MSSQL 2005, and the log above was against MSSQL 2008.

0

Hi,

To fix this problem please do the following:

1. Run "DROP INDEX action_history_object ON action_history" sql query to remove index "action_history_object".
2. Start TC server.
3. Run "CREATE INDEX action_history_object ON action_history (OBJECT_ID)" sql query to recreate this index.

It will fix your problem. You must do it only once, the further server starts will be correct.

This fix will be delivered in the nearest TC release (5.1.3).

0

Hello again,

We managed to upgrade it with the above steps.

The process got stuck again at a later step with this error message:

[2010-07-08 08:30:40,859]   INFO - Side.versioning.VersionManager - Start applying converter Create indices on *history(agent_type_id,build_id) (373)

[2010-07-08 08:30:40,921]  ERROR -   jetbrains.buildServer.SERVER - Exception occured while applying converters

jetbrains.buildServer.serverSide.versioning.ConvertException: Converter jetbrains.buildServer.serverSide.versioning.VersionManager$68 failed with error: SQL error when doing: Execute DDL

SQL query: create index light_history_agt_b_i on light_history (agent_type_id, build_id)

SQL exception: Column name 'agent_type_id' does not exist in the target table or view.

 at jetbrains.buildServer.serverSide.versioning.converters.BaseSqlConverter.convertImpl(BaseSqlConverter.java:6)

 at jetbrains.buildServer.serverSide.versioning.converters.BaseSqlConverter.convert(BaseSqlConverter.java:3)

 at jetbrains.buildServer.serverSide.versioning.VersionManager.doConversion(VersionManager.java:128)

 at jetbrains.buildServer.serverSide.versioning.VersionManager.convert(VersionManager.java:77)

 at jetbrains.buildServer.serverSide.impl.DatabaseConverter$1.run(DatabaseConverter.java:7)

 at jetbrains.buildServer.serverSide.db.DBFacade$3.doInConnection(DBFacade.java:2)

 at jetbrains.buildServer.serverSide.db.DBFacade$9.doInConnection(DBFacade.java:3)

 at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:342)

 at jetbrains.buildServer.serverSide.db.DBFacade._runSql(DBFacade.java:158)

 at jetbrains.buildServer.serverSide.db.DBFacade.runSql(DBFacade.java:149)

 at jetbrains.buildServer.serverSide.db.DBFacade.runSql(DBFacade.java:90)

 at jetbrains.buildServer.serverSide.impl.DatabaseConverter.performConversionWhenNeccessary(DatabaseConverter.java:2)

 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

 at java.lang.reflect.Method.invoke(Unknown Source)

 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1414)

 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1375)

 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)

 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)

 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

 at java.security.AccessController.doPrivileged(Native Method)

 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)

 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)

 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)

 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)

 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254)

 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)

 at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:671)

 at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:610)

 at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:622)

 at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:584)

 at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:193)

 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:925)

 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:835)

 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)

 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

 at java.security.AccessController.doPrivileged(Native Method)

 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)

 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)

 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)

 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)

 at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)

 at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)

 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)

 at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:402)

 at jetbrains.buildServer.rootDispatcher.spring.WebDispatcherServlet.createWebApplicationContext(WebDispatcherServlet.java:7)

 at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:316)

 at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:282)

 at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)

 at javax.servlet.GenericServlet.init(GenericServlet.java:212)

 at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet.createServerServlet(TeamCityDispatcherServlet.java:114)

 at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet.processStartupServerInternal(TeamCityDispatcherServlet.java:12)

 at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet.processServerStartup(TeamCityDispatcherServlet.java:60)

 at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet.access$000(TeamCityDispatcherServlet.java:76)

 at jetbrains.buildServer.rootDispatcher.TeamCityDispatcherServlet$1.run(TeamCityDispatcherServlet.java:2)

 at java.lang.Thread.run(Unknown Source)

Caused by: jetbrains.buildServer.serverSide.db.UnexpectedDBException: SQL error when doing: Execute DDL

SQL query: create index light_history_agt_b_i on light_history (agent_type_id, build_id)

SQL exception: Column name 'agent_type_id' does not exist in the target table or view.

 at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)

 at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820)

 at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258)

 at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632)

 at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:584)

 at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:546)

 at net.sourceforge.jtds.jdbc.JtdsStatement.executeImpl(JtdsStatement.java:723)

 at net.sourceforge.jtds.jdbc.JtdsStatement.execute(JtdsStatement.java:1160)

 at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)

 at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)

 at jetbrains.buildServer.serverSide.db.DBFunctions.executeDdls(DBFunctions.java:179)

 at jetbrains.buildServer.serverSide.versioning.VersionManager$68.convertInternal(VersionManager.java:1)

 at jetbrains.buildServer.serverSide.versioning.converters.BaseSqlConverter.convertImpl(BaseSqlConverter.java:40)

 ... 61 more

Caused by: java.sql.SQLException: Column name 'agent_type_id' does not exist in the target table or view.




I've sort of did a best guess and did this query   create index light_history_agt_b_i on light_history (agent_name, build_id)
TC was able to complete its process and displays a login page. So I think we can close this issue, although the index could be on the wrong column

Thanks
0

Hi,

Seems the problem is not only in non-existing index: according to the error there is no "agent_type_id" column in "light_history" table.

Did you have any problems with converter 368 ("Add agent_type_id to history and light_history tables") during upgrade? Was the upgrade process interrupted at this place?

Can you please provide me your database scheme or check by yourself the existence of this column?

And if you have a backup I strongly recommend you to restore it and try to upgrade again.

0

Please sign in to leave a comment.