Written on Tuesday, June 18, 2013 on http://sgros.blogspot.fr/

This is a short note on how I upgraded Alfresco. The basic idea was to just replace WAR files while keeping configuration files with local modifications intact. To be able to do that, I’ll unpack WAR archive, integrate changes I made to running instance of Alfresco, create new WAR archives and place them in tomcat webapps folder so that he unpacks and deploys them.


So, I downloaded Alfresco 4.2.c. More specifically, I downloaded file alfresco-community-4.2.c.zip. The version I had was 4.0.d.

To find out what configuration files are changed in the running instance I unpacked alfresco.war archive (that file is in the downloaded archive) into a separate directory using unzip command. I suggest that you create directory alfresco, enter that directory and then run unzip command. There, I run the following script:

for i in `find . -path ./WEB-INF/classes/alfresco/messages -prune -o -name \*properties -print`
# If file doesn’t exist we don’t need to check it, go to next one
[ -f $OLDPATH/$i ] || continue
# If the old and new files are the same, then skip it also
cmp -s $OLDPATH/$i $i && continue
# diff -uN $OLDPATH/$i $i | less
echo $i

The script showed me what files have changed:


Of those, localization files are not important (the ones ending in _[a-z][a-z].properties). If you uncomment a line containing less then the script will compare each file and show you difference in less. Based on that, I factored out the following configuration files that were changed:


I also found that I didn’t change mail configuration data in the file:


The next step was to find what changes are due to local configuration, and which ones are due to the changes in upstream. Namely, I’ll take old configuration files but the changes in the new version have to be propagated. It turned out that repository.properties doesn’t have any changes, while the other three have. So, I started to change files in the new version of Alfresco, that I unpacked. Finally, when all the changes are done, create new archive:

cd ..
mv alfresco.war alfresco.war.OLD
cd alfresco
zip -9rv ../alfresco .
cd ..
mv alfresco.zip alfresco.war

The first two commands rename old archive, next two create a new archive, and the final command changes name to have extension WAR. I assumed here that you unpacked original WAR archive into directory called alfresco.
All this has to be done with share.war archive too. In my case, the script showed that only log4j.properties has been changed so I incorporated changes and created a modified share.war archive.
Finally, I stopped tomcat, and alfresco using:

service tomcat6 stop

created a copy of existing alfresco and share directories in tomcat’s webapp directory. I also renamed old alfresco.war and share.war, and moved the ones I prepared in their place. Take care about permissions, tomcat has to be owner of everything! Then, I started tomcat with:

service tomcat6 start

and also started to pray that it works. Well, almost, I watched logs (/var/log/tomcat6/catalina.out) because I doubt that praying would help. 😉
Everything was OK, i.e. errors that I received (openoffice, pdf2swf) were expected because I didn’t inistalled them. But, two errors were not expected:

java.io.FileNotFoundException: alfresco.log (Permission denied)

well, that one was cause by share.war not being able to reopen log file already being used by alfresco.war. So, I changed in appropriate log4j.properties that it uses its own separate log file. Except that it turned that I forgot to change log4j.properties. Anyway, I gave separate log to share.war just to be on a safe side and to finish this finally. The second error was:

java.net.BindException: Permission denied

That one was caused by FTP server not being able to bind to a low numbered port. This is OK, because I’m not running tomcat as a root. So, I’m safe to ignore it.

Laisser un commentaire

Choisissez une méthode de connexion pour poster votre commentaire:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion / Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion / Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion / Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion / Changer )

Connexion à %s