How to deploy Alfresco on WSO2 Stratos Application Server(1.5.1) and WSO2 Appserver (4.1.0)

Archived Content
This article is provided for historical perspective only, and may not reflect current conditions. Please refer to relevant product page for more up-to-date product information and resources.
  • By Sanjeewa Malalgoda
  • 2 Dec, 2011

Applies To

WSO2 Appserver 4.1.0
WSO2 Stratos Application Server 1.5.1

Bit about products and terms


Alfresco is the open source alternative for Enterprise Content Management (ECM), providing Document Management, Collaboration, Records Management, Knowledge Management, Web Content Management, and Imaging. If you need more information on alfresco, go to to their home page by clicking this link.

WSO2 Stratos

WSO2 Stratos is the most complete, enterprise-grade, open PaaS, with support for more core services than any other available PaaS today. Developers can simply click to add users and services, develop new applications, and manage their own setup. New services automatically participate in and benefit from governance policies already in place. In addition, new service versions can be deployed and tested side-by-side with versions in production, allowing traffic to be carefully diverted to newer versions .Go to stratos product home by this link.

WSO2 Stratos Application Server

With WSO2 Stratos Application Server, you can serve both sets of users and easily share logic, management, monitoring, and more. The WSO2 Stratos Application Server brings together the best-of-breed in open source technologies for Web Applications with Apache Tomcat, and Web Services with Apache Axis2.The WSO2 Stratos Application Server, supporting the development, deployment, and management of Web Services and Web applications, is delivered as a multi-tenant, elastically-scaling, metered platform.

To try ApplicationServer in cloud environment, please visit this link

How to modify war files

We can deploy alfresco on both WSO2 ApplicationServer 4.1.0 and Stratos Application server 1.5.1. Let’s take a look at how to deploy alfresco on WSO2 Application Serve and Stratos Application server. First, we have to modify alfresco-wso2.war file by following the guidelines provided. I have briefly listed out the steps.

01. Unpack the war file

02. Remove Catalina jar file

03. Add mysql connector jar to the lib folder (alfresco/alfresco/WEB-INF/lib)

04. Add database configuration entries to alfresco/WEB-INF/classes/alfresco/

Let’s investigate in detail how this can be done.

01. Unpack the .war file

We have to modify Alfresco War file in order to use it on WSO2 Application server. Alfresco war file is designed to be used with tomcat sever. WSO2 Appserver has an inbuilt tomcat server. We have to do few modifications to alfresco war file before hosting on Appserver. First, unpack war file; then you will see following tree.

02. Remove Catalina jar file

Then we have to remove Catalina jar file from the war file. Go to alfresco/alfresco/WEB-INF/lib inside lib folder you will see Catalina jar. Then delete it.

03. Basic Database configuration change

Now we have to do Database configurations for the war file. We need mysql jar file (mysql-connector-java-5.0.8-bin.jar). Download it from here.

Next, we have to add it to the lib folder (alfesco/alfresco/WEB-INF/lib) inside extracted war file.

Tell alfresco specifically what our DB Connector is by editing the file located at alfresco/WEB-INF/classes/alfresco/.

Add the following entry to line 73 of the file which is located at alfresco/WEB-INF/classes/alfresco/ db.driver=com.mysql.jdbc.Driver

We have configured the Data Source successfully. Note the following entries at alfresco/WEB-INF/classes/alfresco/

#Database configuration


04.Database related modifications

For database creation, I suggest two different methods. You can have your own mysql database or databse hosted at WSO2 Stratos Data Services Server.

01. How to use mysql database

Follow these steps to create a database for alfresco.

mysql -u root -p < ./extras/databases/mysql/db_setup.sql or type

mysql> create database alfresco default character set utf8;

mysql> create user alfresco identified by 'alfresco';

mysql> grant all on alfresco.* to 'alfresco'@'localhost' identified by 'alfresco' with grant option;

mysql> grant all on alfresco.* to 'alfresco'@'localhost.localdomain' identified by 'alfresco' with grant option;

Now type show databases; and you will see the following database structure.

02. How to use WSO2 Stratos Data Services Server (DSS) for database

When we use Stratos application server for databases, we can use WSO2 Data Services Server to manage databases. It provides a simplified user interface for users. The WSO2 Data Services Server, a platform for hosting data services with service hosting, service testing, and message tracing features, is delivered as a multi-tenant, elastically-scaling, metered platform. Data as a Service exposes the data stored in a database. Database-level operations can be done using the interface provided by Data as a Service. Let’s see how to create a database using StratosLive DSS.

Go to “create database” page in the console.

The user interface has database name and url. Next, go to “manage”.

Create a privileged group. Add the user and set a privilege group. We now have all the necessary properties for database connection.

We can use these permissions for database connection. Take a look at the following configurations:

# Database configuration


How to avoid BindException: Permission denied

The SMB/CIFS server uses ports 137, 138 and 139 and the FTP server defaults to using port 21. All of these ports are in the privileged socket range, so if you use these directly you will be required to run Appserver from a privileged account. You can run SMB/CIFS on non privileged ports on Unix, provided you redirect privileged ports to the unprivileged ones.

First, ensure that alfresco is using unprivileged ports:

Edit /alfresco/WEB-INF/classes/alfresco/file-servers.xml and un-comment following entries

<tcpipSMB port="1445" ipv6="${cifs.ipv6}" platforms="linux,solaris,macosx"/> 
<netBIOSSMB sessionPort="1139" namePort="1137" datagramPort="1138" platforms="linux,solaris,macosx"/>

Generate the war file to deploy on the sever Now that we have fixed all the issues in war file, we have to re- create the war file from the extracted folder. Select all folders inside that extracted folder and encode as a jar file. Rename the war as alfresco-wso2.war and deploy it directly on WSO2 Application server. Copy the war file to /wso2as-4.1.0/repository/deployment/server/webapps or upload it using GUI.

Deploying the war file on Application server

Setting memory usage of Appserver

Before we can start deploying Alfresco, make sure your server installation has a configured heap size of at least 256 MB. By default, Tomcat is started with the default heap size of your JVM. Usually, with these default settings, the deployment of Alfresco will fail. Set the following parameter at file which is available at #wso2as-4.1.0/bin

export JAVA_OPTS='-Xms128m -Xmx1024m -XX:MaxPermSize=256m -server'

Once you finish the database creation, you will be able to deploy alfresco properly. Run, deploy the war file and try the service.

Fixing minor issues after deployment

You may get following error due to previous installations of alfresco on your system. Let’s see how to fix it.

[2011-09-08 09:28:46,932] ERROR {org.springframework.web.context.ContextLoader} - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dictionaryRepositoryBootstrap' defined in class path resource [alfresco/core-services-context.xml]: Invocation of init method failed; nested exception is org.alfresco.error.AlfrescoRuntimeException: Failure during rollback: [email protected]742ee Caused by: org.alfresco.error.AlfrescoRuntimeException: Failure during rollback: [email protected]742ee at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(

To fix the above issue we can do two simple things.

01. Go to /wso2as-4.1.0/alf_data folder and delete all the contents inside /wso2as-4.1.0/alf_data

02. Go to mysql terminal and type

mysql> drop database alfresco;

mysql> create database alfresco default character set utf8;

Restart Application server to see the deployed service.

Deploy on Stratos Application Server

Though you can deploy the war file created above on Application server, you cannot deploy it on the Stratos application server due to security constrains. If you try, you will see errors. We have 2 solutions to this problem.

01. You jave to sign the jar files with server security key file. Use the following command to do that.

wso2stratos-as-1.5.1$ jarsigner -keystore repository/resources/security/wso2carbon.jks -storepass wso2carbon location_of_jarfile wso2carbon

02. We can disable security from Stratos Application server by removing the following 2 entries from the file located at wso2stratos-as-1.5.1/bin folder.

# \
#$CARBON_HOME/repository/conf/sec.policy \

Now we can deploy the war file without any issues. Go to webservices and refresh the window. You can see the Alsresco service.

finally you will see following window when you clicked on alfresco link available on above window.

Why tenants can’t deploy it on stratosLive.

Alfresco uses wso2stratos-as-1.5.1/alf_data for keeping alfresco related data. For each alfresco deployment, we need a separate folder. If one tenant has already deployed it, the next tenant will not be able to deploy it because that also tries to access the same folder and database.

WSO2 Stratos is architected to accelerate and ease the development of SaaS applications with built-in support for multi-tenant and single-tenant models, user identity management, metering and billing, data storage and access, caching, queuing and more. According to the design of Stratos, multiple tenants can deploy the same war file without any issues. But when this comes to alfresco installation, it fails due to the way alfresco is deployed on the server. By its design, we can run only one alfresco instance on one tomcat server. So the best way to deploy alfresco on public Stratos deployment is for the super tenant to first deploy it on Application Server and allow other users (Tenants) to use it.


Hopefully, this walk through has demonstrated the relative ease by which organizations may benefit from having a secure, searchable content and document repository running on WSO2 Application Server. With this, enterprises can enjoy the benefits of managing all content regardless of how or where is used. WSO2 Application servers is complete application server which provides complete browser-based management console with support for monitoring, tracing, logging, security configuration, and more. alfresco war has designed to deploy on tomcat servers. So we need do few changes to war before deploy it on WSO2 application servers. Due to the design alfresco cannot deploy in Stratos 1.5.1 multi-tenant environment but still possible to deploy by super tenant. With future improvements on Stratos Application Server tenants may allow do deploy alfresco within their tenant domain.


Alfresco home

WSO2 Stratos home

WSO2 StratosLive Application Server home page

MySql downloads page


Sanjeewa Malalgoda, Software Engineer, WSO2 Inc.

About Author

  • Sanjeewa Malalgoda
  • Associate Director, Engineering | Architect at WSO2
  • WSO2