First we need to get the war version of alfresco from a download site.  The one I used was alfresco-labs-war-3Stable.zip. Extract the contents to a temporary folder.

The next step is to set up the database.  If you’ve already installed the default version of Alfresco you’ll need to drop the database and recreate it.  Either way, you’ll find mysql scripts in extra/databases/mysql for setting up or dropping the schema.   See Using Alfresco for document management Part One for details on how to do a default install of Alfresco and for configuring Open Office.

You now need to extract alfresco.war to edit the contents. I expanded it into exploded/alfresco.war so I can copy the alfresco.war folder directly into my jboss application when I’m ready to deploy.

We need to configure the war for deployment in JBoss. You’ll find the config files needed in the extensions/extension folder. The ones we want are:
custom-hibernate-dialect.properties
custom-repository.properties
custom-repository-context.xml

Copy these to exploded/alfresco.war/WEB-INF/classes/alfresco/extension

In custom-repository.properties you need to set the dir.root to point to where you want to store your alfresco data. Also uncomment and set the database values – don’t forget to disable the derby settings also.

Finally you need to set the external executable locations. What I did here was copy the ImageMagick and bin folders from the default Alfresco install into my root folder containing alf_data.  Otherwise you will need to install missing executables yourself.

custom-repository.properties:
dir.root=C:/Alfresco/alf_data

db.username=alfresco
db.password=alfresco
db.pool.initial=10
db.pool.max=100

ooo.exe=C:/Program Files/OpenOffice.org 3/program/soffice
ooo.user=${dir.root}/oouser
img.root=C:/Alfresco/ImageMagick
swf.exe=C:/Alfresco/bin/pdf2swf

db.driver=org.gjt.mm.mysql.Driver
db.url=jdbc:mysql://localhost/alfresco

Now update the hibernate dialect in custom-hibernate-dialect.properties
# MySQL dialect (default) hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect

I used JBoss 4.2.2 as my application server.  Before deploying you should edit jboss-4.2.2.GA/server/default/deploy/ejb3.deployer/META-INF/persistence.properties to change hibernate.bytecode.provider from javassist to cglib.
hibernate.bytecode.provider=cglib

To avoid getting permgen out of memory errors you will probably need to configure your JBOSS_HOME/bin/run.bat to increase the memory size.
set JAVA_OPTS=%JAVA_OPTS% -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512

You can now try coping alfresco.war into your jboss application. Assuming this doesn’t cause a spectacular display of stack traces, when the server finally starts up you can try accessing the application at http://localhost:8080/alfresco.

You’re now ready to start figuring out how to use alfresco as it is, or integrate it with other applications.

Next – Creating a workspace using a web service API

%d bloggers like this: