Wednesday, July 9, 2008

How to deploy WSO2 ESB on Apache Tomcat

WSO2 ESB can be deployed on differnt application servers such as IBM WebSphere, BEA WebLogic Server, JBoss and Apache Tomcat. I will be describing how one can easily deploy WSO2 ESB on Apache Tomcat. A similar article has been written on how to deploy WSO2 ESB on WebLogic by Asankha Perera - Running the WSO2 Enterprise Service Bus (ESB) on the WebLogic Application Server.


Step 1 - Downloading and installing Apache Tomcat

You can download the latest version of Apache Tomcat from here (I will be using Apache Tomcat 5.5.26 to demonstrate this scenario).
Extract the downloaded distribution to a specific location and define the environment variables properly.

E.g.: -
export CATALINA_HOME=/opt/installations/tomcat/apache-
tomcat-5.5.26
export PATH=$PATH:$CATALINA_HOME/bin


Next you will need to enable HTTPS on Apache Tomcat since WSO2 ESB runs over HTTPS. To do this, access the server.xml file located at $CATALINA_HOME/conf and uncomment the following.

<Connector port="8443" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"/>


Then you will need to provide the keystore file location along with it's password as below.

<Connector port="8443" maxHttpHeader
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystore="/opt/wso2esb-1.7/webapp/WEB-INF/classes
/conf/identity.jks"

keypass="password">


Step 2 - Starting the Apache Tomcat Server

Now you can start the Apache Tomcat server by giving the following command.
sh ./catalina.sh run

Step 3 - Downloading and installing WSO2 ESB

Download the latest WSO2 ESB distribution from here and extract to a specific location. (E.g.:- /opt/wso2esb-1.7)

Step 4 - Changing necessary files of the WSO2 ESB distribution

In order for the deployement to be successful you will need to change some files of the WSO2 ESB distribution.

a) Editing the web.xml
To begin with you will need to change the init parameter of "ESBStartUpServlet" of the web.xml which is located at /opt/wso2esb-1.7/webapp/WEB-INF as below.

<servlet>
<servlet-name>ESBStartUpServlet</servlet-name> <servlet-class>org.wso2.esb.transport.tomcat.
StartUpServlet</servlet-class>
<init-param>
<param-name>esb.home</param-name>
<param-value>/opt/wso2esb-1.7</param-value>
</init-param>


b) Editing the axis2.xml
Next you will need to change the paths of the keystore and truststore files specified in the axis2.xml as below specifying the absolute paths.

<parameter name="keystore" locked="false">
<KeyStore>
<Location>/opt/wso2esb-1.7/webapp/WEB-INF/
classes/conf/identity.jks
</Location>
<Type>JKS</Type>
<Password>password</Password>
<KeyPassword>password</KeyPassword>
</KeyStore>
</parameter>
<parameter name="truststore" locked="false">
<TrustStore>
<Location>/opt/wso2esb-1.7/webapp/WEB-INF
/classes/conf/trust.jks
</Location>
<Type>JKS</Type>
<Password>password</Password>
</TrustStore>
</parameter>


Now all the required files are edited and you can create a .war file with all the required files of WSO2 ESB.

Step 5 - Creating the WSO2 ESB .war file

Navigate to the folder /opt/wso2esb-1.7/webapp and type the command.

jar -cvf esb.war *

It would create a war file inside the /opt/wso2esb-1.7/webapp folder.

Step 6 - Deploying the esb.war on Apache Tomcat

Now navigate to $CATALINA_HOME/webapps folder and drop the esb.war file which you created. If everything goes well the WSO2 ESB server should start successfully and you should see something like the following on the console which you started the Apache Tomcat server.

2008-07-09 15:09:02,030 ......INFO ServerManager Ready for processing
2008-07-09 15:09:03,654 ......INFO ServiceBusManager [ESB] Start request completed


Step 7 - Login to the WSO2 ESB Administration Console

Now you should be able to login to the WSO2 ESB Administration Console as, https://localhost:8443/esb

No comments: