How to install alfresco on WSO2 Appserver 4.1.0

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.
With WSO2 Application Server you can serve both sets of users and easily share logic, management, monitoring, and more. The WSO2 Application Server brings together the best of breed in open source technologies for Web Applications with Apache Tomcat, and Web Services with Apache Axis2. If you wish to aware more about WSO2 Application server go to here
We need WSO2 Application server to use as application server
you can download it from following url
http://wso2.org/downloads/appserver/
Then we need alfresco war file. you can download it by clicking on Alfresco war file or you can download alfresco file archive from their web site
Then we have to modify Alfresco War file in order to use it on WSO2 Application server. Alfresco war file has designed to use with tomcat sever. WSO2 Appserver has inbuilt tomcat server.we have to do few modifications to alfresco war file before host on Appserver.We will see those steps in detail now.
First unpack war file then you will see following three
.
|—css
|--images
|--index.jsp
|--jsp
|--META-INF
|--scripts
|--services
|--WEB-INF
|—wsdl
Then we have to remove Catalina jar file from the that war file.Go to alfresco/alfresco/WEB-INF/lib inside lib folder you will see Catalina jar. Then delete it.
META-INF.
        |—classes
        |--lib
        |—licenses

Database configuration change
Now we have to do Database configurations for war file.First we need mysql jar file(mysql-connector-java-5.0.8-bin.jar). Download mysql jar file from here.
Next we have to add it to the lib folder(alfesco/alfresco/WEB-INF/lib) inside extracted war file
Then we have to tell alfresco specifically what is our DB Connector.To do that we have to edit file located at alfresco/WEB-INF/classes/alfresco/.
Add the following entry to the line 73 of repository.properties file which is located at alfresco/WEB-INF/classes/alfresco/repository.properties
db.driver=com.mysql.jdbc.Driver
So we have configured Data Source successfully.
see the following entries at alfresco/WEB-INF/classes/alfresco/repository.properties

# Database configuration
db.schema.update=true
db.driver=com.mysql.jdbc.Driver
db.name=alfresco
db.url=jdbc:mysql:///${db.name}
db.username=alfresco
db.password=alfresco
db.pool.initial=10
db.pool.max=20

How to avoid BindException: Permission denied
The SMB/CIFS server uses ports 137, 138 and 139, 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.
Firstly ensure alfresco is using unprivileged ports:
    Edit /alfresco/WEB-INF/classes/alfresco/file-servers.xml
    and uncomment

<tcpipSMB port="1445" platforms="linux,solaris,macosx"/>
<netBIOSSMB sessionPort="1139" namePort="1137" datagramPort="1138" platforms="linux,solaris,macosx"/>

Now we have fix all the issues in war file. so now we have to re create war file from the extracted folder. select all folders inside extracted folder and encode as jar file and rename it as alfresco-wso2.war. So now we can deploy this war file directly on WSO2 Application server.Copy war file in to /wso2as-4.1.0/repository/deployment/server/webapps or upload it using GUI. see the following figures.
Screenshot
Figure: From this window you will be able to upload war file
Screenshot-1
Figure: You will see deployed war files after refreshing UI
Screenshot-3
Figure : After clicking on deployed alfresco application you will see above window

Setting up database
Now we have to create databse for alfresco.To create database you have to follow next few steps   

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 following database structure

+------------------------------+
| Database                       |
+------------------------------+
| information_schema       |
| alfresco                         |
| mysql                            |
| test                               |
+------------------------------+

4 rows in set (0.00 sec)
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 following parameter at wso2server.sh file which is available at #wso2as-4.1.0/bin
export JAVA_OPTS='-Xms128m -Xmx1024m -XX:MaxPermSize=256m -server'
  
Once you finished database creation you  will be able to deploy alfresco properly. run wso2server.sh and deploy war file and try the service.

Fixing minor issue after deployment
If you get following error we have to clear /wso2as-4.1.0/alf_data folder and we have to re create database
[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: org.alfresco.repo.dictionary.DictionaryRepositoryBootstrap$1@354742ee
Caused by:
org.alfresco.error.AlfrescoRuntimeException: Failure during rollback: org.alfresco.repo.dictionary.DictionaryRepositoryBootstrap$1@354742ee
    at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:281)
To fix the above issue
Delete all the contents inside /wso2as-4.1.0/alf_data
Go to mysql trminal and type
mysql> drop database alfresco;
mysql> create database alfresco default character set utf8;
Then restart Application server. Then you will see deployed service if you have any problems or issues please ask i will reply you soon.






1 comment:

  1. hi,

    i am struck in deploying share explorer in wso2AS,but able to deploy Alfresco sucessfully

    ReplyDelete

Empowering the Future of API Management: Unveiling the Journey of WSO2 API Platform for Kubernetes (APK) Project and the Anticipated Alpha Release

  Introduction In the ever-evolving realm of API management, our journey embarked on the APK project eight months ago, and now, with great a...