bengreen.eu Circle Device

 

Techie Stuff

Projects

Quick Reference

Will be moved to Quick Reference soon

Compiling Alfresco from SVN

I want to try and update some of the FME extensions to Alfresco's Datalists so that they work on Alfresco 4.x. Before trying to do that I decided to download the source code for Alfresco and compile it on my machine.

java.lang.ClassNotFoundException: org.apache.bsf.engines.javascript.JavaScriptEngine

My first problem, after making sure I had the latest version of Apache Ant and looking on the web for anyone who had a problem like this I found a reference to a bug report and a possible solution: http://issues.alfresco.com/jira/browse/ALF-10344 the alfresco engineer just replied and said nothing to help. Well, binduwavell I sympathise!

The cryptic reference to manager="javax" I did not understand so I fixed the problem I was having like this:

build.xml:
<!-- Where to get BSF/Rhino from if on Java 1.5 --> <condition property="classpath.bsf_javascript"   else="${dir.project.3rdparty.lib}/bsf-2.4.0.jar:${dir.project.3rdparty.lib}/rhino-js-1.6R7.jar:${dir.project.3rdparty.lib}/commons/commons-logging-1.1.jar"   value="${dir.project.3rdparty.lib}/bsf-2.4.0.jar:${dir.project.3rdparty.lib}/rhino-js-1.6R7.jar:${dir.project.3rdparty.lib}/commons/commons-logging-1.1.jar"   <equals arg1="${ant.java.version}" arg2="1.5" /> </condition>

As you can see I just made my version of java use the same stuff as Java 5 would have. This seems to work fine!

I use Gentoo and I emerged tomcat-7 (apt-get install for you Debian/Ubuntu users), allowed my user to write to TOMCAT_HOME / CATALINA_HOME in my case this is /usr/share/tomcat-7 and ran the build script. TOMCAT_HOME is not set (the instructons on the Alfresco wiki say you should set it for deployment). One thing missing is any mention of VIRTUAL_TOMCAT_HOME, I assume this is the location of config files. Or APP_TOMCAT_HOME which is where share.war is put.

export TOMCAT_HOME=/usr/share/tomcat-7
export VIRTUAL_TOMCAT_HOME=/home/ben/virtualtomcathome
ant incremental-tomcat

Tomcat Configuration

Alfresco expects that it will be able to find all the classes and files you put in $TOMCAT_HOME/shared/classes/ and $TOMCAT_HOME/lib/*.jar this is fine but is not the default setup of Tomcat. To make it work properly and find the all important alfresco-global.properties edit $TOMCAT_HOME/conf/catalina.properties so that it has this line in it (by default it is empty)

shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar

Then both share and Alfresco should be able to find the various properties and configuration loaded in this directory.

Tomcat does not stop when I run shutdown.sh

Tomcat has this bloody annoying problem of not stopping if you were to ask it to using the shutdown.sh script without any arguments. I found that some service was listening on a random port (may not be a problem for you). Setting CATALINA_PID before running startup.sh, in the usual UNIX way, will allow you to run shutdown.sh that will force the JVM to stop.

export CATALINA_HOME=/opt/apache-tomcat-6.0.35
export CATALINA_PID=$CATALINA_HOME/temp/catalina.pid
bin/startup.sh
bin/shutdown.sh 30 -force

This will give the process 30 seconds to terminate and if still running will issue a kill signal. This is useful in many applications.

Quick Links: Techie Stuff | General | Personal | Quick Reference