Monthly Archives: April 2013

Installing Alfresco (4.1.1) with JBoss (EAP 5.1.1)

With your Alfresco install you may have decided that Tomcat as an application server is not robust enough. You can opt for WebSphere, WebLogic and even JBoss if you feel you require the extra functionalities. This article addresses how to install Alfresco with JBoss.

First, you’ll need the JBoss installer. I had to get mine at access.redhat.com. Keep in mind though, Alfresco still only supports 5.1.1 EAP (enterprise version of JBoss). My installer looks like this file: jboss-eap-installer-5.1.1.jar.

I also went out and got the Java JDK 1.6.0_33 to use with this. For this installation I used Alfresco Enterprise 4.1.1. You’ll want to get the .ear file for this instead of the usual .zip file you get for Tomcat.

So, getting started, install the JDK to the directory of your choice. I have to install a number of different versions of Java, Alfresco, Tomcat and JBoss so I tend to have a top level directory with each of those names and then install the particular version beneath it. My installation of Java and JBoss look this respectively:

  • /java/jdk1.6.0_33
  • /jboss/jboss-eap-5.1

Install JBoss is fairly simple. You simply run the following:

# <path_to_jdk1.6.0_33>/bin/java -jar jboss-eap-installer-5.1.1.jar

To make it simple, I’ll refer to JBOSS_HOME as my jboss directory:

/jboss/jboss-eap-5.1/jboss-as

Follow the instructions and install it. Next, put alfresco-enterprise-ear-4.1.1.zip into a tmp directory and unzip it. You’ll also have to “unzip” the resulting alfresco-enterprise-ear.4.1.1.ear. If you need to, you can change the .ear extension to .zip to get the unzip to work.

Copy the alfresco-global.properties.sample file from the temporary directory to the <JBOSS_HOME>/server/default/conf directory as alfresco-global.properties minus the .sample on the end.

Make sure you refer to this article on how to set up your repository. Remember that you’ll need to create a database, modify it for Alfresco use and set up a directory to use for your contentstore and indexes. Edit the parameters in the alfresco-global.properties.sample file to suit your environment. Save the alfresco-global.properties in the conf dir.

Here are my settings. Please adjust to reflect your environment. Make sure these lines are added in your alfresco-global.properties file:

dir.root=/srv/4119jboss/alf_data
dir.license.external=/jboss/jboss-eap-5.1/jboss-as/server/default/conf/alfresco/extension/license
db.username=alfresco
db.password=alfresco
ooo.exe=/alfresco/4119/openoffice/program/soffice.bin
ooo.enabled=false
ooo.port=8100
img.root=/alfresco/4119/common
img.dyn=${img.root}/lib
img.exe=${img.root}/bin/convert
swf.exe=/alfresco/4119/common/bin/pdf2swf
swf.languagedir=/alfresco/4119/common/japanese
jodconverter.enabled=true
jodconverter.officeHome=/alfresco/4119/openoffice
jodconverter.portNumbers=8100
db.driver=org.gjt.mm.mysql.Driver
db.url=jdbc:mysql://localhost/alf4119jboss?useUnicode=yes&characterEncoding=UTF-8
index.subsystem.name=lucene
index.recovery.mode=FULL
alfresco.context=alfresco
alfresco.host=${localname}
alfresco.port=8080
alfresco.protocol=http
#
share.context=share
share.host=${localname}
share.port=8080
share.protocol=http
alfresco.rmi.services.host=0.0.0.0

Copy the alfresco.war and share.war file from the tmp directory to the <JBOSS_HOME>/deploy directory
Copy database jdbc driver to <JBOSS_HOME>/server/default/lib
Add URIEncoding=”UTF-8″ to Connector stanzas for 8080 and 8009 in both of these files:

  • <JBOSS_HOME>/server/default/deploy/jbossweb.sar/server.xml
  • <JBOSS_HOME>/server/all/deploy/jbossweb.sar/server.xml

JBoss by default can have a lot of debug entries in the logs. To squelch this a bit, edit the <JBOSS_HOME>/server/default/conf/jboss-log4j.xml file to reduce the huge debug log output:

<root>
 <priority value="INFO" />
 <appender-ref ref="CONSOLE"/>
 <appender-ref ref="FILE"/>
</root>

Add these log settings to the <JBOSS_HOME>/server/default/conf/jboss-log4j.xml file:

<category name="org.jboss.logging.Log4jService$URLWatchTimerTask">
 <priority value="INFO"/>
</category>
<category name="org.jboss.system.server.Server">
 <priority value="INFO"/>
</category>
<category name="org.jboss">
 <priority value="WARN"/>
</category>
<category name="net">
 <priority value="WARN"/>
</category>
<category name="org.alfresco">
 <priority value="WARN"/>
</category>
<category name="org.alfresco.repo.policy">
 <priority value="WARN"/>
</category>
<category name="org.springframework">
 <priority value="WARN"/>
</category>
<category name="org.hibernate">
 <priority value="WARN"/>
</category>
<category name="org.hibernate.cache.ReadWriteCache">
 <priority value="ERROR"/>
</category>
<category name="org.hibernate.cache.EhCacheProvider">
 <priority value="ERROR"/>
</category>
<category name="org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog">
 <priority value="ERROR"/>
</category>
<category name="org.apache.myfaces">
 <priority value="ERROR"/>
</category>
<category name="org.jbpm.jpdl.xml.JpdlXmlReader">
 <priority value="ERROR"/>
</category>

Save this file and next, edit the <JBOSS_HOME>/server/default/deployers/ejb3.deployer/META-INF/jpa-deployers-jboss-beans.xml file, and then change the hibernate.bytecode.provider=javassist line to hibernate.bytecode.provider=cglib.

For example:

<entry>
 <key>hibernate.bytecode.provider</key>
 <value>cglib</value>
</entry>

Add these to your <JBOSS_HOME>/bin/run.sh file near the top:

export JAVA_HOME=/alfresco/4119/java
JBOSS_CLASSPATH="/jboss/jboss-eap-5.1/jboss-as/server/default/conf"

Then, after this line:

JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"

add these:

JAVA_OPTS="$JAVA_OPTS -Xms512m -Xmx1024m -XX:MaxPermSize=512m"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote -Dalfresco.home=."

Edit the filtered packages list.

Open the <JBOSS_HOME>/server/default/deployers/jbossweb.deployer/META-INF/war-deployers-jboss-beans.xml file, and then locate the filteredPackages property of the WarClassLoaderDeployer bean.

Open the <extension>\war-deployers-jboss-beans.xml.fragment.sample file.
This sample file contains a WarClassLoaderDeployer bean definition fragment for use when configuring JBoss.

Copy the full WarClassLoaderDeployer bean from the sample file.
In the war-deployers-jboss-beans.xml file, paste the sample bean fragment over the WarClassLoaderDeployer bean. The bean definition contains the filteredPackages list that is required for Alfresco. This list is on one line and must not contain any breaks.

Save the <JBOSS_HOME>/server/default/deployers/jbossweb.deployer/META-INF/war-deployers-jboss-beans.xml file.

Now, the moment of truth. Go to JBoss Server <JBOSS_HOME>/bin and do:

# ./run.sh -b 0.0.0.0  <- This will allow JBoss to bind to all ip addresses. 
*Change it to suit your environment if needed.

The alfresco.log file will be generated wherever you start it. So if you are in <JBOSS_HOME>/bin you should see it there. You can “tail” the file and follow along. Work through any issues. Try to access it like you would any other Alfresco install (http://<hostname>:<port>/share) and voila! Success! Hopefully 😉

Cheers! -H.S.