Deploying your First Custom Web Application
The WSO2 Application Server supports Apache Tomcat based Web application deployment. All you need to do is to bundle your Web application as a .war
archive with all your Web application related resources and all third-party libraries, and then deploy the archive. This sample demonstrates how you can get started quickly with WSO2 Application Server, by deploying your custom web application.
You can use Maven or Apache Ant to deploy the applications as follows:
Using Maven to deploy applications
Apache Maven 3 is recommended to build the samples.
Follow the steps given below before you build and run the sample.
- Open a command prompt and navigate to the base directory of the sample (i.e.,
<PRODUCT_HOME>\samples\HelloWorldWebapp
). Build the demo and create a WAR file using the following command.
mvn clean install
This will create the sample webapp WAR file (wso2appserver-samples-hello-webapp-1.0.war file) in the
target
folder of the<AS_HOME>/samples/<sample-name>
directory.- Start the WSO2 Application Server by following the instructions in Running the Product.
- You can deploy the web app in two ways:
- Manually copy the WAR file to the
<AS_HOME>/repository/deployment/server/webapps
directory. - Deploy the WAR file you created in step 2 using the management console as detailed here.
- Manually copy the WAR file to the
Using Apache Ant to deploy applications
You can find the sample discussed here in the <AS_HOME>/samples/HelloWorldWebapp
directory.
The steps are as follows:
- Run the WSO2 Application Server. For instructions see, Running the Product.
In a command prompt, switch to the samples directory.
For example, in Windows:cd <AS_HOME>\samples\HelloWorldWebapp
Enter the following command:
ant
This will copy the sample webapp (wso2appserver-samples-hello-webapp-1.0.war file) in to <AS_HOME>/repository/deployment/server/webapps/ directory. If you log into the Application Server, you will see the deployed webapp on the Running Applications screen.