Error after deploying the uppgrade to 6.5

I got this error when I did deploy the application after upgrade to 6.5


2017-04-26 23:22:10.297 ERROR [localhost-startStop-1] com.haulmont.cuba.core.sys.AppContextLoader - Error initializing application
java.lang.RuntimeException: java.lang.RuntimeException: Error running Groovy script
	at com.haulmont.cuba.core.sys.dbupdate.DbUpdaterImpl.doUpdate(DbUpdaterImpl.java:102) ~[cuba-core-6.5.0.jar:6.5.0]
	at com.haulmont.cuba.core.sys.dbupdate.DbUpdaterEngine.updateDatabase(DbUpdaterEngine.java:86) ~[cuba-core-6.5.0.jar:6.5.0]
	at com.haulmont.cuba.core.sys.AppContextLoader.updateDatabase(AppContextLoader.java:114) ~[cuba-core-6.5.0.jar:6.5.0]
	at com.haulmont.cuba.core.sys.AppContextLoader.afterInitAppContext(AppContextLoader.java:106) ~[cuba-core-6.5.0.jar:6.5.0]
	at com.haulmont.cuba.core.sys.AbstractWebAppContextLoader.contextInitialized(AbstractWebAppContextLoader.java:74) ~[cuba-global-6.5.0.jar:6.5.0]
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745) [catalina.jar:8.5.14]
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207) [catalina.jar:8.5.14]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:8.5.14]
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752) [catalina.jar:8.5.14]
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) [catalina.jar:8.5.14]
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) [catalina.jar:8.5.14]
	at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952) [catalina.jar:8.5.14]
	at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823) [catalina.jar:8.5.14]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_121]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]
Caused by: java.lang.RuntimeException: Error running Groovy script
	at com.haulmont.cuba.core.sys.AbstractScripting.runGroovyScript(AbstractScripting.java:248) ~[cuba-global-6.5.0.jar:6.5.0]
	at com.haulmont.cuba.core.sys.dbupdate.DbUpdaterImpl.executeGroovyScript(DbUpdaterImpl.java:90) ~[cuba-core-6.5.0.jar:6.5.0]
	at com.haulmont.cuba.core.sys.dbupdate.DbUpdaterEngine.executeScript(DbUpdaterEngine.java:401) ~[cuba-core-6.5.0.jar:6.5.0]
	at com.haulmont.cuba.core.sys.dbupdate.DbUpdaterEngine.doUpdate(DbUpdaterEngine.java:228) ~[cuba-core-6.5.0.jar:6.5.0]
	at com.haulmont.cuba.core.sys.dbupdate.DbUpdaterImpl.doUpdate(DbUpdaterImpl.java:99) ~[cuba-core-6.5.0.jar:6.5.0]
	... 17 common frames omitted
Caused by: groovy.util.ResourceException: Unable to find resource 20-reports/update/postgres/17/170201-migrateSecurityIndex.upgrade.groovy:
File /opt/tomcat/webapps/app-core/conf/20-reports/update/postgres/17/170201-migrateSecurityIndex.upgrade.groovy doesn't exist
File web-inf:db/20-reports/update/postgres/17/170201-migrateSecurityIndex.upgrade.groovy doesn't exist
Classpath resource 20-reports/update/postgres/17/170201-migrateSecurityIndex.upgrade.groovy doesn't exist

	at com.haulmont.cuba.core.sys.AbstractScripting$CubaResourceConnector.getResourceConnection(AbstractScripting.java:406) ~[cuba-global-6.5.0.jar:6.5.0]
	at groovy.util.GroovyScriptEngine.loadScriptByName(GroovyScriptEngine.java:545) ~[groovy-all-2.4.4.jar:2.4.4]
	at groovy.util.GroovyScriptEngine.createScript(GroovyScriptEngine.java:605) ~[groovy-all-2.4.4.jar:2.4.4]
	at groovy.util.GroovyScriptEngine.run(GroovyScriptEngine.java:592) ~[groovy-all-2.4.4.jar:2.4.4]
	at com.haulmont.cuba.core.sys.AbstractScripting.runGroovyScript(AbstractScripting.java:227) ~[cuba-global-6.5.0.jar:6.5.0]
	... 21 common frames omitted
2017-04-26 23:22:10.298 INFO  [localhost-startStop-1] com.haulmont.cuba.core.sys.CubaCoreApplicationContext - Closing com.haulmont.cuba.core.sys.CubaCoreApplicationContext@40a620f2: startup date [Wed Apr 26 23:21:58 CEST 2017]; root of context hierarchy
2017-04-26 23:22:10.301 INFO  [localhost-startStop-1] com.haulmont.cuba.core.sys.CubaThreadPoolTaskScheduler - Shutting down ExecutorService 'scheduler'
26-Apr-2017 23:22:10.320 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
26-Apr-2017 23:22:10.321 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [/app-core] startup failed due to previous errors
26-Apr-2017 23:22:10.343 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [app-core] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
26-Apr-2017 23:22:10.362 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /opt/tomcat/webapps/app-core.war has finished in 18,832 ms
26-Apr-2017 23:22:10.365 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /opt/tomcat/webapps/app.war
26-Apr-2017 23:22:14.353 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
apr 26, 2017 11:22:14 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing AtmosphereFramework
apr 26, 2017 11:22:14 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath

I can’t see the execution of upgrade SQL Script.

I have attached the log file from Tomcat.

catalina.txt (3.4M)

Hi Kjell,

The problem is same as “Error in Jelastic after migrating to 6.5”. We’ll fix it in the next bugfix release of 6.5.

Workaround for Postgres:

  • Stop Tomcat
  • Connect to the Postgres database and execute SQL script:

INSERT INTO sys_db_changelog(script_name, create_ts, is_init) VALUES ('20-reports/update/postgres/17/170201-migrateSecurityIndex.upgrade.groovy', CURRENT_TIMESTAMP, 0);
  • Start Tomcat
  • Navigate to Administration → Jmx Console
  • Finx jmx bean: app-core.reports:type=ReportingMigrator and execute method updateSecurityIndex

If you use another database, please change script path in the INSERT to the corresponding database. E.g. for MSSQL use script:


INSERT INTO sys_db_changelog(script_name, create_ts, is_init) VALUES ('20-reports/update/mssql/17/170201-migrateSecurityIndex.upgrade.groovy', CURRENT_TIMESTAMP, 0);

Still got the same error message.

Kjell,

Could you send me an output of the SQL query:


select * from sys_db_changelog

Here you go.

sys_db_changelog.csv (20.8K)

Hi Kjell,

I couldn’t find any update scripts for 6.5 in the sys_db_changelog output. I think it’s a problem with WAR building.
Please try following steps:

  • Perform clean task in the Studio
  • Build WARs and deploy on Tomcat
  • Start Tomcat

Please send me log file from Tomcat and output of sys_db_changelog if it doesn’t start.

I tried to Perform clean task in the Studio, ran BuildWar, deploy to server.
Got the same error. Then I discovered that in the conf folder the groovy script
webapps/app_test_core/20-reports/update/postgres/17/170201-migrateSecurityIndex.upgrade.groovy did’t exist so i copied the script from
\WEB-INF\db\20-reports\update\postgres\17\170201-migrateSecurityIndex.upgrade.groovy
and put it into this folder on server and restarted Tomcat.
CUBA found the missing file and ran the procedure.
The solution was up and running.
It looks like the file 170201-migrateSecurityIndex.upgrade.groovy
did’t copy to the webapps/app_test_core/20-reports/update/postgres/17/ folder on deploy.

I have no idea what will happen nest time i deploy. Most likly I will get the same error cause the file is not in the conf folder.

2 posts were split to a new topic: IllegalStateException: Resource not found