Monday, March 16, 2009

Deploying WSO2 Registry on tomcat

WSO2 registry is one of the leading open source registry-repository available today. It allows users to store and manage SOA metadata in a more convenient and manageable manner. WSO2 Registry can be used as a standalone distribution as well as it can be deployed on most of the servlet containers . Following step by step guide will show you how to deploy wso2registry on tomcat.

This guide applies to WSO2 registry 2.0.1 and tomcat-6.0.14

Step 1 – Enable SSL connector in tomcat.

Lets refer to your tomcat installation directory, CATALINA_HOME.

E.g.: -
CATALINA_HOME=C:\apache-tomcat-6.0.14

Now you will need to enable HTTPS on Apache Tomcat since WSO2 REGISTRY 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" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile = "C:\Carbon\ESB\tomcat\WSO2-registry-2.0.1\resources\security\wso2carbon.jks"
keystorePass="wso2carbon"

One could find the wso2carbon.jks file inside the /resources/security/ directory in wso2 registry installation home.

Step 2 - Downloading and installing WSO2 Registry

Download the latest WSO2 Registry distribution from here and extract to a specific location. (E.g.:- C:\Carbon\Registry\tomcat\WSO2 registry 2.0.1). From this folder copy the folders,

- conf
- database
- resources
- repository

to a separate folder. (E.g.:- C:\Carbon\REGISTRY\tomcat\registry_home)

Step 3 - Setting environmental variables

You will have to set an environment variable with the name CARBON_HOME pointing it to the directory which you copied the above files to.

E.g.:-
CARBON_HOME=C:\Carbon\REGISTRY\tomcat\registry_home


Step 4 - Copying required files to Apache Tomcat

Now create a folder inside the webapps folder of Tomcat.

E.g.:-
C:\apache-tomcat-5.5.20\webapps\wso2registry

Next, you need to copy the WEB-INF folder, which is in the folder which you extracted the downloaded Registry distribution. Then copy it into the registry folder which you created above.

E.g.:-
Copy
C:\Carbon\REGISTRY\tomcat\WSO2-registry-2.0.1\webapps\ROOT\WEB-INF
to
C:\WSO2\Installations\apache-tomcat-6.0.14\webapps\wso2registry

Step 5 - Changing necessary files of the WSO2 Registry distribution

a) Open the carbon.xml file which is in the CARBON_HOME\conf folder and specify the following URL as the backend ServerURL

E.g.:-
https://localhost:8443/wso2registry/services/

b) Next open the axis2.xml which is located inside the CARBON_HOME\conf and change the http port from 9763 to 8080 (the default http port of Tomcat) and the https port from 9443 to 8443.

c) In addition to the above, you need to specify the correct paths for the two .jks files wso2carbon.jks and client-truststore.jks specified in the axis2.xml and also the wso2carbon.jks file specified in the carbon.xml file.

d) Then you need to specify the absolute paths of the WSO2CARBON_DB of the two files registry.xml and user-mgt.xml

E.g.:- Change
jdbc:derby:database/WSO2CARBON_DB;create=true
to
jdbc:derby:C:\Carbon\REGISTRY\tomcat\registry_home\WSO2CARBON_DB;create=true

Step 6 - Starting the Apache Tomcat Server

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

Step 7 - Login to the WSO2 Registry Administration Console

Now you should be able to login to the WSO2 Registry Administration Console as, https://localhost:8443/wso2registry/carbon

Guide to deploy other wso2 product on tomcat server is available also.

1. WSO2 Web Services Application Server (WSAS)
2. WSO2 Enterprise Service Bus (WSO2 ESB)
3. WSO2 Business Process Server (WSO2 BPS)

3 comments:

Unknown said...

Hi
Do you have documentation how to deploy WSO2 Governance Registry 3.6.0 on Tomcat. The folder structures that you have mentioned that has changed.
I was trying to follow this document but the folder that you talked about WEb-INF, ROOT are not found in 3.6.0
Can you please post some documention or redirect where they are found.

Thanks
Sachin

Krishantha Samaraweera said...

Hi Sachin,

Following documents would be helpful for you. Since WSO2 use same directory structure for all products. You can use the deployment guides for other products with slight changes.

http://wso2.org/library/knowledge-base/2011/03/deploy-wso2bps-apachetomcat
http://wso2.org/library/knowledge-base/2011/01/deploy-wso2-greg-360-weblogic-103

Thanks,
Krishantha.

Yahya KAMAZ said...

Hello,
I try to deploy WSO2 Registry Governance v4.1.1 on Tomcat.

when I finished the tutorial steps, I have an exception:

java.lang.IllegalStateException: instance already set org.wso2.carbon.bridge.BridgeServlet.setInstance (BridgeServlet.java: 227)

The structure of v4.1.1 Registry has changed.

Is there a tutorial for version 4.1.1 please.

Thank you in advance.