Blog

Alfresco Auto-Update Failed Error Message

by | Jan 27, 2014 | Alfresco, Alfresco Development | 0 comments

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).

PROBLEM BACKGROUND:

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(SchemaBootstrap.java:1671)
        at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:56)

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.

SOLUTION:

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, addschema.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"
   defaultAutoCommit="false"
   defaultReadOnly="false"
   debug="10"
          driverClassName="oracle.jdbc.OracleDriver"
          factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
   fairQueue="false"
   initSQL="alter session set nls_timestamp_tz_format = 'DD-MON-RR HH24.MI.SSXFF TZR'"
   initialSize="3"
   jdbcInterceptors="ConnectionState;StatementFinalizer"
   jmxEnabled="true"
   logAbandoned="false"
   maxActive="15"
   maxIdle="10"
   maxWait="10000"
   minEvictableIdleTimeMillis="5000"
   minIdle="5"
   name="alfresco-datasource"
   password="<db_password>"
   removeAbandoned="true"
   removeAbandonedTimeout="60"
          testOnBorrow="true"
   testOnReturn="false"
   testWhileIdle="true"
   timeBetweenEvictionRunsMillis="7000"
   schema.update="<true|false>" type="javax.sql.DataSource"
   url="jdbc:oracle:thin:@127.0.0.1:1521:XE"
   useEquals="false"
   username="<db_username>"
   validationInterval="30000"
   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"
                  name="jdbc/dataSource"
                  type="org.apache.tomcat.jdbc.pool.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 https://wiki.alfresco.com/wiki/Schema_Upgrade_Scripts.

Categories

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *