There is already an object named

I am deploying an update to an application the update has nothing to do adding or dropping any table or columns. It was just a format update. The issue is that when I go to update the war file the database is trying to update. The tables are already there. How do I deploy the update, I cant drop the tables due to the amount of data already in the database.

2020-02-11 19:21:21.482 INFO  [localhost-startStop-1] com.haulmont.cuba.core.sys.MetadataImpl - Initializing metadata
2020-02-11 19:21:21.654 INFO  [localhost-startStop-1] com.haulmont.cuba.core.sys.MetadataImpl - Metadata initialized in 172 ms
2020-02-11 19:21:22.730 INFO  [localhost-startStop-1] com.haulmont.cuba.core.sys.dbupdate.DbUpdaterEngine - Updating database...
2020-02-11 19:21:23.214 INFO  [localhost-startStop-1] com.haulmont.cuba.core.sys.dbupdate.DbUpdaterEngine - Executing script 70-myapp/update/mssql/20/200203-1-createQuarter.sql
2020-02-11 19:21:23.276 ERROR [localhost-startStop-1] com.haulmont.cuba.core.sys.AbstractWebAppContextLoader - Error initializing application
java.lang.RuntimeException: 
=================================================
ERROR: Database update failed. See details below.
=================================================
Error executing SQL script 200203-1-createQuarter.sql
There is already an object named 'MyApp
_QUARTER' in the database.
	at com.haulmont.cuba.core.sys.dbupdate.DbUpdaterEngine.executeSqlScript(DbUpdaterEngine.java:364) ~[cuba-core-6.10.12.jar:6.10.12]
	at com.haulmont.cuba.core.sys.dbupdate.DbUpdaterEngine.executeScript(DbUpdaterEngine.java:422) ~[cuba-core-6.10.12.jar:6.10.12]
	at com.haulmont.cuba.core.sys.dbupdate.DbUpdaterEngine.doUpdate(DbUpdaterEngine.java:237) ~[cuba-core-6.10.12.jar:6.10.12]
	at com.haulmont.cuba.core.sys.dbupdate.DbUpdaterImpl.doUpdate(DbUpdaterImpl.java:164) ~[cuba-core-6.10.12.jar:6.10.12]
	at com.haulmont.cuba.core.sys.dbupdate.DbUpdaterEngine.updateDatabase(DbUpdaterEngine.java:91) ~[cuba-core-6.10.12.jar:6.10.12]
	at com.haulmont.cuba.core.sys.dbupdate.DbUpdaterImpl.updateDatabaseOnStart(DbUpdaterImpl.java:87) ~[cuba-core-6.10.12.jar:6.10.12]
	at com.haulmont.cuba.core.sys.dbupdate.DbUpdaterImpl.applicationInitialized(DbUpdaterImpl.java:79) ~[cuba-core-6.10.12.jar:6.10.12]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_131]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_131]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_131]
	at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:258) ~[spring-context-4.3.23.RELEASE.jar:4.3.23.RELEASE]
	at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:177) ~[spring-context-4.3.23.RELEASE.jar:4.3.23.RELEASE]
	at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:140) ~[spring-context-4.3.23.RELEASE.jar:4.3.23.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-4.3.23.RELEASE.jar:4.3.23.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-4.3.23.RELEASE.jar:4.3.23.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-4.3.23.RELEASE.jar:4.3.23.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393) ~[spring-context-4.3.23.RELEASE.jar:4.3.23.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347) ~[spring-context-4.3.23.RELEASE.jar:4.3.23.RELEASE]
	at com.haulmont.cuba.core.sys.EventsImpl.publish(EventsImpl.java:33) ~[cuba-global-6.10.12.jar:6.10.12]
	at com.haulmont.cuba.core.sys.AbstractAppContextLoader.initAppContext(AbstractAppContextLoader.java:66) ~[cuba-global-6.10.12.jar:6.10.12]
	at com.haulmont.cuba.core.sys.AbstractWebAppContextLoader.contextInitialized(AbstractWebAppContextLoader.java:78) ~[cuba-global-6.10.12.jar:6.10.12]
	at com.haulmont.cuba.core.sys.singleapp.SingleAppCoreContextLoader.contextInitialized(SingleAppCoreContextLoader.java:56) [cuba-core-6.10.12.jar:6.10.12]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_131]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_131]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_131]
	at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:215) [spring-core-4.3.23.RELEASE.jar:4.3.23.RELEASE]
	at com.haulmont.cuba.core.sys.singleapp.SingleAppCoreServletListener.contextInitialized(SingleAppCoreServletListener.java:88) [cuba-core-6.10.12.jar:6.10.12]
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745) [catalina.jar:8.5.15]
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207) [catalina.jar:8.5.15]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:8.5.15]
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752) [catalina.jar:8.5.15]
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) [catalina.jar:8.5.15]
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) [catalina.jar:8.5.15]
	at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952) [catalina.jar:8.5.15]
	at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823) [catalina.jar:8.5.15]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [na:1.8.0_131]
	at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.8.0_131]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_131]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_131]
	at java.lang.Thread.run(Unknown Source) [na:1.8.0_131]
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: There is already an object named 'MYAPP_QUARTER' in the database.
	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:254) ~[mssql-jdbc-7.0.0.jre8.jar:na]
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1608) ~[mssql-jdbc-7.0.0.jre8.jar:na]
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:859) ~[mssql-jdbc-7.0.0.jre8.jar:na]
	at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:759) ~[mssql-jdbc-7.0.0.jre8.jar:na]
	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7240) ~[mssql-jdbc-7.0.0.jre8.jar:na]
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2869) ~[mssql-jdbc-7.0.0.jre8.jar:na]
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:243) ~[mssql-jdbc-7.0.0.jre8.jar:na]
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:218) ~[mssql-jdbc-7.0.0.jre8.jar:na]
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(SQLServerStatement.java:739) ~[mssql-jdbc-7.0.0.jre8.jar:na]
	at org.apache.tomcat.dbcp.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:294) ~[tomcat-dbcp.jar:8.5.15]
	at org.apache.tomcat.dbcp.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:294) ~[tomcat-dbcp.jar:8.5.15]
	at com.haulmont.cuba.core.sys.jdbc.ProxyStatement.lambda$execute$2(ProxyStatement.java:106) ~[cuba-core-6.10.12.jar:6.10.12]
	at com.haulmont.cuba.core.sys.jdbc.ProxyStatement.executeSqlStatement(ProxyStatement.java:257) ~[cuba-core-6.10.12.jar:6.10.12]
	at com.haulmont.cuba.core.sys.jdbc.ProxyStatement.execute(ProxyStatement.java:106) ~[cuba-core-6.10.12.jar:6.10.12]
	at com.haulmont.cuba.core.sys.dbupdate.DbUpdaterEngine.executeSql(DbUpdaterEngine.java:377) ~[cuba-core-6.10.12.jar:6.10.12]
	at com.haulmont.cuba.core.sys.dbupdate.DbUpdaterEngine.executeSqlScript(DbUpdaterEngine.java:362) ~[cuba-core-6.10.12.jar:6.10.12]
	... 41 common frames omitted
2020-02-11 19:21:23.276 INFO  [localhost-startStop-1] com.haulmont.cuba.core.sys.singleapp.SingleAppCoreContextLoader$1 - Closing com.haulmont.cuba.core.sys.singleapp.SingleAppCoreContextLoader$1@24dcaf99: startup date [Tue Feb 11 19:21:12 CST 2020]; root of context hierarchy
2020-02-11 19:21:23.276 INFO  [localhost-startStop-1] com.haulmont.cuba.core.sys.CubaThreadPoolTaskScheduler - Shutting down ExecutorService 'scheduler'
2020-02-11 19:21:23.370 INFO  [localhost-startStop-1] com.haulmont.cuba.core.sys.AppComponents - Using app components: [com.haulmont.cuba, de.balvi.cuba.declarativecontrollers, de.diedavids.cuba.dataimport]
2020-02-11 19:21:23.386 INFO  [localhost-startStop-1] com.haulmont.cuba.core.sys.AbstractWebAppContextLoader - Loading app properties from classpath:com/company/myapp/web-app.properties
2020-02-11 19:21:23.386 INFO  [localhost-startStop-1] com.haulmont.cuba.core.sys.AbstractWebAppContextLoader - Loading app properties from /WEB-INF/local.app.properties
2020-02-11 19:21:23.386 INFO  [localhost-startStop-1] com.haulmont.cuba.web.sys.singleapp.SingleAppWebContextLoader$1 - Refreshing com.haulmont.cuba.web.sys.singleapp.SingleAppWebContextLoader$1@1610d7aa: startup date [Tue Feb 11 19:21:23 CST 2020]; root of context hierarchy
2020-02-11 19:21:25.117 INFO  [localhost-startStop-1] com.haulmont.cuba.core.sys.remoting.discovery.StaticServerSelector - Server URLs: [http://localhost:8080/myapplogs-core/remoting]
2020-02-11 19:21:25.133 INFO  [localhost-startStop-1] com.haulmont.cuba.web.sys.remoting.WebRemoteProxyBeanCreator - Configuring proxy beans for local service invocations: [cuba_LoginService, cuba_AuthenticationService, cuba_TrustedClientService, cuba_ServerInfoService, cuba_UserSettingService, cuba_UserManagementService, cuba_DataService, cuba_ConfigStorageService, cuba_PersistenceManagerService, cuba_LockService, cuba_UserSessionService, cuba_FoldersService, cuba_EmailService, cuba_FileStorageService, cuba_EntitySnapshotService, cuba_UniqueNumbersService, cuba_LocalizedMessageService, cuba_ResourceService, cuba_ScheduledTasksService, cuba_EntityLogService, cuba_TestingService, cuba_ObjectsCacheManagerService, cuba_DomainDescriptionService, cuba_RelatedEntitiesService, cuba_EntitySqlGenerationService, cuba_NumberIdService, cuba_QueryResultsService, cuba_DynamicAttributesCacheService, cuba_EntityRestoreService, cuba_LocalFileExchangeService, cuba_EntityImportExportService, cuba_ScreenProfilerService, cuba_ServerTokenStore, cuba_IdpService, cuba_ConstraintLocalizationService, cuba_AttributeAccessService, cuba_ExceptionReportService, cuba_BulkEditorDataService]
2020-02-11 19:21:25.133 INFO  [localhost-startStop-1] com.haulmont.cuba.web.sys.remoting.WebRemoteProxyBeanCreator - Configuring proxy beans for local service invocations: [ddcdi_GenericDataImporterService, ddcdi_ImportWizardService, ddcdi_UniqueEntityFinderService]
2020-02-11 19:21:25.133 INFO  [localhost-startStop-1] com.haulmont.cuba.web.sys.remoting.WebRemoteProxyBeanCreator - Configuring proxy beans for local service invocations: []
2020-02-11 19:21:26.771 INFO  [localhost-startStop-1] com.haulmont.cuba.core.sys.CubaThreadPoolTaskScheduler - Initializing ExecutorService 'scheduler'
2020-02-11 19:21:27.223 INFO  [localhost-startStop-1] com.haulmont.cuba.core.sys.jmx.MBeanExporter - Registering beans for JMX exposure: [myapplogs.cuba:type=ConfigStorage, myapplogs.cuba:type=CachingFacade, myapplogs.cuba:type=FileUploading, myapplogs.cuba:type=JmxNodeIdentifier, myapplogs.cuba:type=JmxLogControl, myapplogs.cuba:type=ClassLoaderManager, myapplogs.cuba:type=StatisticsCounter]
2020-02-11 19:21:27.239 INFO  [localhost-startStop-1] com.haulmont.cuba.core.sys.MetadataImpl - Initializing metadata
2020-02-11 19:21:27.566 INFO  [localhost-startStop-1] com.haulmont.cuba.core.sys.MetadataImpl - Metadata initialized in 327 ms
2020-02-11 19:21:27.582 INFO  [localhost-startStop-1] com.haulmont.cuba.core.sys.AbstractWebAppContextLoader - AppContext started
2020-02-11 19:21:28.003 INFO  [localhost-startStop-1] com.haulmont.cuba.web.sys.singleapp.SingleAppDispatcherServlet - FrameworkServlet 'dispatcher': initialization started
2020-02-11 19:21:28.019 INFO  [localhost-startStop-1] com.haulmont.cuba.web.sys.singleapp.SingleAppDispatcherServlet$1 - Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Tue Feb 11 19:21:28 CST 2020]; parent: com.haulmont.cuba.web.sys.singleapp.SingleAppWebContextLoader$1@1610d7aa
2020-02-11 19:21:30.094 INFO  [localhost-startStop-1] com.haulmont.cuba.web.sys.singleapp.SingleAppDispatcherServlet - FrameworkServlet 'dispatcher': initialization completed in 2091 ms
2020-02-11 19:21:30.109 INFO  [localhost-startStop-1] com.haulmont.restapi.sys.SingleAppRestApiServlet - FrameworkServlet 'rest_api': initialization started
2020-02-11 19:21:30.109 INFO  [localhost-startStop-1] com.haulmont.restapi.sys.SingleAppRestApiServlet$1 - Refreshing WebApplicationContext for namespace 'rest_api-servlet': startup date [Tue Feb 11 19:21:30 CST 2020]; parent: com.haulmont.cuba.web.sys.singleapp.SingleAppWebContextLoader$1@1610d7aa
2020-02-11 19:21:32.293 INFO  [localhost-startStop-1] com.haulmont.restapi.sys.SingleAppRestApiServlet - FrameworkServlet 'rest_api': initialization completed in 2184 ms

Hi @olson92.

If you do not want to execute this script, please add it to SYS_DB_CHANGELOG table as executed.

1 Like