WSO2Con 2013 CFP Banner

How to Setup WSO2 WSAS 2.0 on Apache Tomcat

WSO2 Web Services Application Server is an open source service-based application server fully built on Apache Axis2 framework. It supports various Web services standards and protocols.

Date: Wed, 17th Dec, 2008
Level: Intermediate
Reads: 8144
Discuss this article on Stack Overflow
Chamara Silva
Senior Software Engineer - QA
WSO2 Inc.
chamara's picture

                        WSO2 Web Services Application Server  is capable of being deployed on most common application servers. These include application servers such as Apache Tomcat , IBM WebSphere , BEA WebLogic Server and JBoss. In this tutorial, I explain, how WSAS can be deployed on the Apache Tomcat application server. Following are the steps that need to be followed:

     Step1

                Download the Web Services Application Server and unzip the package.

     Step2

                Download Apache Tomcat and unzip the package

     Step 3

                Tomcat needs WSAS resource files running on it, in addition to the WSAS deployment package during run time. So you should assign the entire resource file in one environment variable. To do so,

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

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

    C. Paste the copied folder on to “CarbonRepo”

    D. Set the environment variable named “CARBON_HOME” to point to the folder named “CarbonRepo”

   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 needs to be deployed in Apache Tomcat. To do so, follow the instructions below:

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

 Image1

 

    B.      Create a folder in Tomcat “webapps” folder and paste the WEB-INF folder there

image2 

     Step 5

                Now, you need 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. Add the following script tag need to Apache Tomcat's server.xml file.

            <Connector

           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"/>

          <!-- Define an AJP 1.3 Connector on port 8009 -->

          <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

         

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

                    If your CARBON_HOME is in “D:\Projects\Carbon\WSAS\ CarbonRepo”, here is the complete path that needs to be added in the kerstoreFile parameter.

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

                C. HTTPS 8443 port is now open for Apache Tomcat.

 

     Step 6

                Next, you should change WSAS “Server URL” in the carbon.xml file. You need to add the name of the folder you created in the Tomcat web apps folder as the server url. Following are the steps to change WSAS carbon.xml:

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

                        B. Change the HTTPS port number from 9443 to 8443. (Tomcat HTTPS enables in port 8443)

                           C. If the name of the folder in WSAS webapps is “WSAS”,

D.                        Your Final server url should be:


                    <ServerURL>https://localhost:8443/WSAS/services/</ServerURL>

      Step 7

                 You need to now do a small modification in Axis2.xml as well. In Tomcat, HTTP transport is enabled in port 8080, but for WSAS HTTP it is enabled in port 9763. Because of this you have to re-map the HTTP and HTTPS port umbers in WSAS Axis2.xml. Change the HTTP port number from 9763 to 8080 and HTTPS from 9443 to 8443. This should be as follows:

                       <transportReceiver name="http"

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

                       <parameter name="port">8080</parameter>

                       </transportReceiver>

                      <transportReceiver name="https"

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

                      <parameter name="port">8443</parameter>

                      </transportReceiver>

             To enable WSAS tools, you need to make another change in the Axis2.xml file by adding “carbon” after the back slash in the context root parameter.

      Ex: -  <parameter name="contextRoot">/carbon</parameter>

 

      Step 8

                 Apache Tomcat configurations are all completed now. Start the Tomcat server. Here are the steps:

                         A. Go to Tomcat's bin folder on command prompt.

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

                Upon starting up Apache Tomcat, use the following URL to access WSAS:

                https://localhost:8443/wsas/carbon

           

       Author: Chamara Silva is a Senior Software Engineer at WSO2. chamara at wso2 dot com

baron_barnaby.yahoo.com's picture

Tomcat is not the same as the

Tomcat is not the same as the Apache web server, which is a C implementation of an HTTP web server; these two web servers are not bundled together, although they are frequently used together as part of a server application stack. Chicago Movers
adamsjake11.gmail.com's picture

very good tutorial

you don't normally see such good and detailed tutorials. this tutorial comes in handy when deploying a tomcat server. the web services server is a great product which has proved to be useful time and again. www.interactivemediadegree.net/
597529167.qq.com's picture

http://www.atcoachoutletsonli

http://www.atcoachoutletsonline.net Coach Outlet http://www.getcoachfactoryoutlet.org Coach Factory http://www.louisvuittonhandbagsoutlet.org/ Louis Vuitton Handbags Outlet http://www.saleincoachoutlets.com Coach Outlet Online http://www.atcoachoutletsonline.net Coach Outlet Online http://www.getcoachfactoryoutlet.org Coach Factory Outlet http://www.louisvuittonhandbagsoutlet.org/ Louis Vuitton Handbags http://www.saleincoachoutlets.com Coach Outlet http://www.coachfactoryoutlet-s.org Coach Factory Outlet http://www.buycoachoutletonline.org Coach Outlet http://www.coachoutletonfactory.net Coach Outlet http://www.buycoachoutletonline.org Coach Outlet Online
samashtishukla.gmail.com's picture

How to deploy wsasa in jboss

After following all the steps to deploy in jboss. when i am starting my jbosss the i am getting error By seeing the below logs it seems that wsas is not deployed in jboss. Please suggest that where i am wrog? What mistake i am doing ? 20:00:34,467 INFO [TomcatDeployment] deploy, ctxPath=/jmx-console, vfsUrl=jmx-console.war 20:00:34,567 INFO [TomcatDeployment] deploy, ctxPath=/wso2wsas, vfsUrl=wso2wsas.war 20:00:40,967 ERROR [STDERR] log4j:ERROR A "org.jboss.logging.appender.FileAppender" object is not signable to a "org.apache.log4j.Appender" variable. 20:00:40,967 ERROR [STDERR] log4j:ERROR The class "org.apache.log4j.Appender" was loaded by 20:00:40,967 ERROR [STDERR] log4j:ERROR [org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@ 47961] whereas object of type 20:00:40,977 ERROR [STDERR] log4j:ERROR "org.jboss.logging.appender.FileAppender" was loaded by [o .jboss.system.NoAnnotationURLClassLoader@3ee284]. 20:00:40,977 ERROR [STDERR] log4j:ERROR Could not instantiate appender named "FILE". 20:00:41,517 INFO [STDOUT] 20:00:41,517 FATAL [Activator] Cannot start User Manager Core bundle java.lang.NullPointerException at org.wso2.carbon.user.core.internal.Activator.start(Activator.java:62) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java 82) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContext pl.java:773) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java 54) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352) at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:370) at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1068) at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelMana r.java:557) at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.ja :464) at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelMa ger.java:248) at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelMana r.java:445) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:220) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:330) 20:00:41,688 INFO [STDOUT] 20:00:41,688 INFO [CarbonCoreActivator] Starting WSO2 Carbon... 20:00:41,688 INFO [STDOUT] 20:00:41,688 INFO [CarbonCoreActivator] Operating System : Windows XP .1, x86 20:00:41,698 INFO [STDOUT] 20:00:41,698 INFO [CarbonCoreActivator] Java Home : C:\Program iles\Java\jdk1.6.0_17\jre 20:00:41,698 INFO [STDOUT] 20:00:41,698 INFO [CarbonCoreActivator] Java Version : 1.6.0_17 20:00:41,698 INFO [STDOUT] 20:00:41,698 INFO [CarbonCoreActivator] Java VM : Java HotSp (TM) Server VM 14.3-b01,Sun Microsystems Inc. 20:00:41,698 INFO [STDOUT] 20:00:41,698 INFO [CarbonCoreActivator] Carbon Home : D:\wso2ser r\WSAS3.1.2\wsas-repo 20:00:41,708 INFO [STDOUT] 20:00:41,708 INFO [CarbonCoreActivator] Java Temp Dir : C:\DOCUME~ ShuklaSD\LOCALS~1\Temp\ 20:00:41,708 INFO [STDOUT] 20:00:41,708 INFO [CarbonCoreActivator] User : ShuklaSD,
pmhofman's picture

multiple servers on tomcat

Hi, great tutorial. I was wondering if it is possible to run both WSAS and ESB on tomcat. Thanks, Peter
johnwang's picture

Which WSAS version was used in these steps?

I tried to deploy WSAS 3.1 to Tomcat 6 but both https://localhost:8443/WSAS/services/ and https://localhost:8443/wsas/carbon give me 404.
chamara's picture

Need to change Context url

This tutorial wrote based on the carbon 2.0 release.so if you want to deploy wsas 3.1 on the tomcat, you have to change the context url in carbon.xml according to the this tutorial you have to insert "WSAS" in to the context root. "<WebContextRoot>WSAS</WebContextRoot>" Thanks & regards, Chamara
johnwang's picture

Changed but ...

Made changes to carbon.xml as you suggested but still getting 404 and "proxyservlet is not available" errors. Anything to check in CarbonRepo\repository\components\plugins such as javax.servlet.jspxxxx.jar?
mikpan's picture

Question

After I did the necessary steps and started TOMCAT, got the error: java.io.FileNotFoundException: Instance of a WSO2 User Manager has not been created. user-mgt.xml is not found. Please set the carbon.home at org.wso2.carbon.user.core.internal.Activator.getConfigurationElement(Activator.java:106) at org.wso2.carbon.user.core.internal.Activator.start(Activator.java:48) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:999) Investigating that in the code, I found out that "carbon.home" global variable is set improperly, but I did not set it up. What could be the cause and the correction? Thank you!
chamara's picture

Tomcat issue

This issue may cause because of the CARBON_HOME environment variable could not set properly or during the server run it cant find a user management xml. Set the CARBON_HOME variable by pointing conf,repository and resources directories(See previous post) and start again tomcat server.if this issue still available copy url of CARBON_DB located,(this has inside the database folder in carbon repo) and copy in to the database url in user-mgt.xml following are the example of that correction. <Database>         <URL>jdbc:derby:D:/Projects/Carbon/WSAS/CarbonHome/database/WSO2CARBON_DB;create=true</URL>
mikpan's picture

correction in the step 7

class="org.wso2.carbon.core.transports.http.HttpsTransportListener"> 8443 instead of class="org.wso2.carbon.core.transports.http.HttpsTransportListener"> 9443
chamara's picture

Port changed. thank you and

Port changed. thank you and sorry for the inconvenience caused.
small_ticket.yahoo.com's picture

WSAS-3.2 ?

The instructions doesn't work for wsas-3.2 and it continues to give 404. Is there any extra changes for wsas-3.2?
skytrip.seo.gmail.com's picture

for me too

yeah i didn't worked for me. http://skytrip.co.uk/cheap-flights-amsterdam.htm