Alfresco 4.2 to 51 Upgrade Steps (Windows)

Alfresco 4.2 to 51 Upgrade Steps (Windows)


Prerequisites 

Take down your running 4.2
Coldbackup - Take backup of your contentstore and database (you can gather the info from alfresco-global.properties file from <alfresco-home>/tomcat/shared/classes directory)




Steps to Upgrade


Step 1. Install Alfresco 5.1 using Windows Installer using postgres database
Select the components such as
Java,
PostgreSQL
GoogleDoc association(optional)
Step 2. Apply the custom amps (if you have any), configurations for Alfresco 5.1 
update ldap
update alfresco-global
apply license
Add MSSQL/MySQL/Oracle(etc) lib
Step 3. Restart the service
Step 4. Validate the amps and its configuration
Step 5. Bring down the alfresco services and restore it using 4.2 content store & DB backup
Update alfresco-global - alf_data location/ to old
Update (old)database info
Step 6. Restart the alfresco instances and sanity check (solr indexing, share)

Alfresco DB Context initialization failed mysql installation error

Alfresco DB Context initialization failed mysql installation error

Alfresco  Context initialization failed mysql installation error


Error log:
org.alfresco.error.AlfrescoRuntimeException: 11010021 Ensure that the 'dir.root' property 'F:\Alfresco51\alf_data' is pointing to the correct data location.
at org.alfresco.repo.admin.ConfigurationChecker.check(ConfigurationChecker.java:263)
at org.alfresco.repo.admin.ConfigurationChecker.access$0(ConfigurationChecker.java:198)
at org.alfresco.repo.admin.ConfigurationChecker$1$1.doWork(ConfigurationChecker.java:186)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:555)
at org.alfresco.repo.admin.ConfigurationChecker$1.execute(ConfigurationChecker.java:182)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:464)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:352)
at org.alfresco.repo.admin.ConfigurationChecker.onBootstrap(ConfigurationChecker.java:192)
at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:56)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEventInternal(SafeApplicationEventMulticaster.java:214)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:185)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:950)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:70)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5524)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:672)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1859)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
2017-12-01 09:40:22,270 INFO  [org.alfresco.enterprise.repo.cluster.core.ClusteringBootstrap] [localhost-startStop-1] Clustering has shutdown.
2017-12-01 09:40:22,270 WARN  [org.springframework.web.context.support.XmlWebApplicationContext] [localhost-startStop-1] Exception thrown from ApplicationListener handling ContextClosedEvent
java.lang.NullPointerException
at org.alfresco.repo.workflow.activiti.ActivitiEngineInitializer.onShutdown(ActivitiEngineInitializer.java:65)
at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:67)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEventInternal(SafeApplicationEventMulticaster.java:214)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:190)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1051)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1012)
at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:586)
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:143)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5063)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5719)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:672)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1859)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Hints

Rule : Contents in Alf_data folder (where alfresco stores contents) matches DB entries

If you are setting up a new environment or is on an upgrade path setting up your environment,
1. Check your database config, if the db is a newly created one and doesnt have any contents in it.
  clear the alf_data\contentstore folder
2. If you are using an existing contentstore  & DB  ensure they are in sync - the backup should have followed Alfresco recommended hot or cold backup procedures.