Tuesday, December 23, 2008

How to Setup WSAS on Apache Tomcat

WSO2 Web Services Application Server is an Open Source service based application server fully built on Apache Axis2 Framework. It supports to manage various web services and protocols.

WSO2 Web Services Application Server capable to deploy most of the application servers. Such as Apache Tomcat , IBM WebSphere , BEA WebLogic Server and JBoss.In this tutorial, I am going to explain how WSAS deploy on the Apache tomcat application server. Following are the steps need to follow.

Step1

Download Web Services Application Server and unzip package.

Step2

Download Apache Tomcat and unzip package

Steps 3

Tomcat need to WSAS resource files other than WSAS deployment package to run on the tomcat server in running time. So you should assign the entire resource files in one environment variable. To do that,

A. Copy “resources”,”conf” and “repository” folders from WSAS unzipped package.

B. Create new folder and name it as a “CarbonRepo”.

C. Paste copied folder in to “CarbonRepo”.

D. Set Environment variable called “CARBON_HOME” by locating “CarbonRepo” folder.

Ex: your CarbonRepo folder in “D:\Projects\Carbon\WSAS\ CarbonRepo

If you are using Linux,

export CARBON_HOME =/Projects/Carbon/WSAS/ CarbonRepo

If you are using Windows,

set CARBON_HOME = D:\Projects\Carbon\WSAS\ CarbonRepo

Step 4

Now WSAS need to deploy in apache tomcat. To deploy following instruction need to follow.

A. Copy “WEB-INF” in unzipped WSAS package/ webapps/ROOT

B. Create folder in tomcat “webapps” folder and paste copied WEB-INF.

Step 5

Now you have to enable https in your tomcat installation.(By default HTTPS protocol is disable in apache tomcat.)

A. Open server.xml in apache tomcat conf folder. This is the script tag need to add in apache tomcat server.xml

port="8443" minSpareThreads="5" maxSpareThreads="75"

enableLookups="true" disableUploadTimeout="true"

acceptCount="100" maxThreads="200"

scheme="https" secure="true" SSLEnabled="true"

keystoreFile="CARBON_HOME/resources/security/wso2carbon.jks" keystorePass="wso2carbon"

clientAuth="false" sslProtocol="TLS"/>



B. You need to locate wso2carbon.jks keystore file in keystoreFile parameter inside the Connector tag.

If your CARBON_HOME in “D:\Projects\Carbon\WSAS\ CarbonRepo”,this is the full path need to add in kerstoreFile parameter.

“D:/Projects/Carbon/WSAS/ CarbonRepo /resources/security/wso2carbon.jks”

C. Now HTTPS 8443 port number open for apache tomcat.

Steps 6

Now you should change WSAS “Server URL” in Server.xml. Because you need to add folder name to server url, what you create in tomcat webapps folder. Following are the instructions to change WSAS server.xml

A. Open server.xml file in your CARBON_HOME/conf folder.

B. Change the HTTPS port number from 9443 to 8443.because tomcat HTTPS enable in 8443 port number.

C. If your folder name is “WSAS” in tomcat webapps folder.

D. Your Final server url should be ,
https://localhost:8443/WSAS/services/

Steps 7

Now you have to do small modification in Axis2.xml as well. In Tomcat HTTP transport enable in port number 8080, but in WSAS HTTP enable in 9763 port number. Because of this you have to re-map those HTTP and HTTPS port umbers in WSAS Axis2.xml.Change the HTTP port number from 9763 to 8080 and HTTPS from 9443 to 8443.that should change as,

class="org.wso2.carbon.core.transports.http.HttpTransportListener">

8080

class="org.wso2.carbon.core.transports.http.HttpsTransportListener">

9443

To enable WSAS tools section you need to do another change in Axis2.xml.add “carbon” after back slash in Context root parameter.

Ex: - /carbon

Step 8

All the apache tomcat configurations finished now.Finally start apache tomcat.

A. Go to the Tomcat bin folder in command prompt/terminal.

B. Start tomcat as,

Windows = apache-tomcat-6.0.14\bin>catalina.bat run

Linux = apache-tomcat-6.0.14\bin>catalina.sh run

Step 9

After start apache tomcat this url you can use for access WSAS.

https://localhost:8443/wsas/carbon