I have recently upgraded Asset Bank and I am seeing an "Exception in preMigrationCheck" error

If you have recently upgraded Asset Bank to a new version and are now seeing an exception similar to the one below then follow the instructions in this article to fix the error.

Sample Error

2011/12/09 09:38:05:426 GMT [INFO] UpgradeManager - UpgradeManager.upgradeAttributeValues: Starting attribute value data migration
2011/12/09 09:38:05:426 GMT [INFO] AttributeMigrationManager - AttributeMigrationManager: performing pre-migration checks
2011/12/09 09:38:05:426 GMT [ERROR] GlobalApplication - runManagerStartups: exception in UpgradeManager com.bn2web.common.exception.Bn2Exception: SQL Exception in preMigrationCheck
	at com.bright.assetbank.attribute.service.AttributeMigrationManager.preMigrationCheck(AttributeMigrationManager.java:226)
	at com.bright.assetbank.attribute.service.AttributeMigrationManager.migrate(AttributeMigrationManager.java:110)
	at com.bright.assetbank.application.service.UpgradeManager.upgradeAttributeValues(UpgradeManager.java:953)
	at com.bright.assetbank.application.service.UpgradeManager.startup(UpgradeManager.java:185)
	at com.bn2web.common.service.GlobalApplication.runManagerStartups(GlobalApplication.java:259)
	at com.bright.assetbank.application.listener.GlobalApplicationInitialiser.doAsynchronousInitialisation(GlobalApplicationInitialiser.java:64)
	at com.bright.assetbank.application.listener.GlobalApplicationInitialiser.run(GlobalApplicationInitialiser.java:59)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.SQLException: Base table or view not found message from server: "Table 'assetbank.attributevalue' doesn't exist"
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
	at com.mysql.jdbc.Connection.execSQL(Connection.java:2251)
	at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1586)
	at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.avalon.excalibur.datasource.AbstractJdbcConnection$ProxiedObject.invoke(AbstractJdbcConnection.java:468)
	at $Proxy3.executeQuery(Unknown Source)
	at com.bright.assetbank.attribute.service.AttributeMigrationManager.preMigrationCheck(AttributeMigrationManager.java:196)
	... 7 more

Explanation

In version 3.533, we improved the performance of Asset Banks with large numbers of assets and/or attributes by changing the way that attributes are stored. The first time Asset Bank starts up after being upgraded it migrates the attribute data from the old to the new tables. If Asset Bank is restarted before the data migration finishes then it will try to perform the data migration again, but this will fail because the data migration has already been partially done.

How to Fix

Obtain the attribute migration rollback script corresponding to the database that you are using (WEB-INF/manager-config/database/util/drop-extra-aav-cols-mysql.sql or drop-extra-aav-cols-sqlserver.sql) from Asset Bank support (mention this article when you contact support).

Shut down Asset Bank (e.g. by stopping Tomcat).

Take a backup of the Asset Bank database.

Run the drop-extra-aav-cols-<database>.sql script. This script cleans up a partially-completed attribute data migration and makes Asset Bank start the data migration from the beginning again next time it is started.

Optional, but recommended: make sure that Asset Bank log level is at least "info" (attribute migration progress messages are logged at "info" level). The log level is configured by the first line in WEB-INF/classes/simplelog.properties, if the log level is set to "warn" or "error" then change it to "info" or "debug":

org.apache.commons.logging.simplelog.log.AssetBank-Standard=debug 

Start Asset Bank. If you have a large number of assets it may take a few minutes to start up (whilst the data migration happens). You can check the data migration progress by searching for AttributeMigrationManager in the Tomcat logs.


Was this article helpful?

Yes No

Thanks for your feedback!