Upgrade to 4.0.x fails due to existing database object

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

問題

Fisheye/Crucible upgrade to 4.0.x fails due to existing database object. The following gets written in atlassian-fisheye.log:

2016-03-16 21:08:04,666 WARN  [main ] org.springframework.web.context.support.XmlWebApplicationContext AbstractApplicationContext-refresh - Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dbControlFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.cenqua.crucible.hibernate.DBControlFactoryImpl]: Constructor threw exception; nested exception is com.cenqua.crucible.hibernate.CruDBException: Problem upgrading with script /path/to/fecru_home/sql/dbtype/upgrade/upgrade_XX.sql: SQL script error on line XX: "create table cwd_application (id numeric(19,0) not null, application_name nvarchar(255) not null, lower_application_name nvarchar(255) not null, created_date datetime2 not null, updated_date datetime2 not null, active nchar(1) not null, description nvarchar(255), application_type nvarchar(32) not null, credential nvarchar(255) not null, primary key (id));" (There is already an object named 'cwd_application' in the database.), please contact http://www.atlassian.com/support/
	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:278) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1115) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:706) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:762) [spring-context-4.0.9.RELEASE.jar:4.0.9.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) [spring-context-4.0.9.RELEASE.jar:4.0.9.RELEASE]
	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) [spring-web-4.0.9.RELEASE.jar:4.0.9.RELEASE]
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) [spring-web-4.0.9.RELEASE.jar:4.0.9.RELEASE]
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) [spring-web-4.0.9.RELEASE.jar:4.0.9.RELEASE]
	at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:775) [jetty-server-8.1.10.v20130312.jar:8.1.10.v20130312]
	at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424) [jetty-servlet-8.1.10.v20130312.jar:8.1.10.v20130312]
	at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:767) [jetty-server-8.1.10.v20130312.jar:8.1.10.v20130312]
	at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249) [jetty-servlet-8.1.10.v20130312.jar:8.1.10.v20130312]
	at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1252) [jetty-webapp-8.1.10.v20130312.jar:8.1.10.v20130312]
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:710) [jetty-server-8.1.10.v20130312.jar:8.1.10.v20130312]
	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494) [jetty-webapp-8.1.10.v20130312.jar:8.1.10.v20130312]
	at com.cenqua.fisheye.web.jetty.FishEyeWebApplicationContext.doStart(FishEyeWebApplicationContext.java:32) [fisheye.jar:?]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.10.v20130312.jar:8.1.10.v20130312]
	at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229) [jetty-server-8.1.10.v20130312.jar:8.1.10.v20130312]
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:172) [jetty-server-8.1.10.v20130312.jar:8.1.10.v20130312]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.10.v20130312.jar:8.1.10.v20130312]
	at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229) [jetty-server-8.1.10.v20130312.jar:8.1.10.v20130312]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.10.v20130312.jar:8.1.10.v20130312]
	at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) [jetty-server-8.1.10.v20130312.jar:8.1.10.v20130312]
	at org.eclipse.jetty.server.Server.doStart(Server.java:280) [jetty-server-8.1.10.v20130312.jar:8.1.10.v20130312]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.10.v20130312.jar:8.1.10.v20130312]
	at com.cenqua.fisheye.web.WebServer.start(WebServer.java:335) [fisheye.jar:?]
	at com.cenqua.fisheye.ctl.Run.mainImpl(Run.java:229) [fisheye.jar:?]
	at com.cenqua.fisheye.ctl.Run.main(Run.java:56) [fisheye.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [?:1.8.0_65]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [?:1.8.0_65]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [?:1.8.0_65]
	at java.lang.reflect.Method.invoke(Method.java:497) [?:1.8.0_65]
	at com.cenqua.fisheye.FishEyeCtl.mainImpl(FishEyeCtl.java:101) [fisheyeboot.jar:?]
	at com.cenqua.fisheye.FishEyeCtl.main(FishEyeCtl.java:44) [fisheyeboot.jar:?]

診断

環境

  • In this specific case Fisheye was being upgraded from 3.10.3 to 4.0.1 and SQL Server 2008 is used as underlying database, but the problem happens regardless of Fisheye version being upgraded from and regardless of database type and version being used.

Diagnostic Steps

  • Connect to the database using the same database username/password configured in Fisheye and check that the table already exists.

原因

  • In this specific case the cwd_application table already existed in the database and that was causing the issue. Very likely this is a leftover from a different Atlassian product, or the database is being shared with a different Atlassian product.

ソリューション

  • Ensure that the database is not shared with any other Atlassian Product. If in doubt, create a new database.
  • Revert Fisheye to the version being upgraded from by restoring a backup, pointing to the new database.
  • Perform the upgrade again.

最終更新日 2018 年 7 月 31 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.