Sunday, November 17, 2013

Alfresco auto-update failed error message

In my last blog, I introduced a complete backup and restore strategy for Alfresco and a custom application that has synchronized data (Alfresco holds repository documents, Application DB holds application specific data).

Another issue I ran into during that mini-project was, often, when starting Alfresco 4.1.2 on a clustered environment I would see the following in the tomcat log:

ERROR [web.context.ContextLoader] [main] Context initialization failed
 org.alfresco.error.AlfrescoRuntimeException: 09100000 Schema auto-update failed
        at org.alfresco.repo.domain.schema.SchemaBootstrap.onBootstrap(

The key issue from the above error is "Schema auto-update failed".  I didn't find much that could help me on internet forums, so wanted to share what worked.  It turns out that error happens because when the Alfresco database schema is restored, Alfresco thinks that the database schema is updated.  I cannot completely explain this nuance, but in this particular case, the schema had in fact, NOT been updated at all.  Just completely restored from a backup.

The clustered Alfresco configuration is using tomcat datasource configuration, so this was the solution that "tricked" Alfresco into thinking that the database schema had NOT changed.

  1. For the type="javax.sql.DataSource" resource attribute, add schema.update="false" THE FIRST TIME you start Alfresco after restoring the schema from the backup.
  2. After Alfresco completely starts up successfully, stop it.
  3. Change schema.update="true" again since Alfresco already started up successfully, so it doesn't think the database got updated.
  4. Start Alfresco again.

Details below...
  • Configure datasource properties in <tomcathome>/conf/server.xml. 
  After the <GlobalNamingResources><Resource /> element, add the following.
  Keep each attribute on its own line.
<Resource auth="Container"
 initSQL="alter session set nls_timestamp_tz_format = &apos;DD-MON-RR HH24.MI.SSXFF TZR&apos;"
 schema.update="<true|false>" type="javax.sql.DataSource"
 validationQuery="select 1 from dual"/>
The following were also configured...
- Configure resource in <tomcathome>/conf/context.xml.
  Before the </Context> element, add the following.
  Keep each attribute on its own line.
    <ResourceLink global="alfresco-datasource"
- Since we're running Tomcat 6, need to add tomcat-jdbc.jar to the <tomcathome>/lib folder.

** UPDATE:  Since we are not upgrading the alfresco version, you can safely always set schema.update="false" in server.xml until an upgrade actually needs to be performed.  Reference

No comments:

Post a Comment

I appreciate your time in leaving a comment!