Skip to main content

Deploy application at ROOT(/) context in Tomcat

Tomcat has its own application with the name "ROOT" that is runing in the main root (/) context path, So when ever you install new tomcat and try to accesss http://localhost:8080/ then it will show you the default tomcat home page,


If you want to deploy you application at  http://localhost:8080/  then there is two way to do this

1. ROOT.war : Create your application war file with the name ROOT.war and place it in the [TOMCAT_HOME]/webapps/ directory and restart tomcat services

2. Server.xml : If you can't change the war file name then in server.xml file there is one context tag  that is use to map your application on any context

  • Remove the ROOT folder directory from [TOMCAT_HOME]/webapps/
  • Copy your application war file into the same directory , let suppose your application war file name is "app.war".
  • Edit the server.xml file located at [TOMCAT_HOME]/conf/server.xml, and add the context tag
    <Context path="/" docBase="app" reloadable="true"></Context>
docBase : Your application war file name
path : Context path at which you want to map your application , here I am using "\" that mean I am mapping your application at root context

   





Comments

Popular posts from this blog

Encode from JavaScript and Decode at Java.

if you have a senerio like you want to send encoded parameter values from your web page  and decode them  at server side then this blog may be help you. JavaScript: Before submit the form I am encoding all the value entered by user so that it can not be read by humanly, for encoding the values I have written a method named  encodeBase64 <script> function encodeBase64(input){         var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";         input = escape(input);         var output = "";         var chr1, chr2, chr3 = "";         var enc1, enc2, enc3, enc4 = "";         var i = 0;              do {             chr1 = input.charCodeAt(i++);             chr2 = input.charCodeAt(i++);     ...

Setup Jenkins in Tomcat Webserver

Jenkins is a software that allows continuous integration. Jenkins will be installed on a server where the central build will take place. System Requirements: 1. JDK 2. Tomcat Java installation : 1. Download the latest JDK from Oracle's site 2. CentOS look for the package jdk-7u17-linux-x64.rpm (64-bit architecture) or jdk-7u17-linux-i586.rpm (32-bit architecture) 3. Once you download the installation package, use the command rpm -ivh 4. Confirm you have the correct Java by running java -version Tomcat installation: 1. Download Apache Tomcat archive file from Apache Tomcat official download page. You can use below wget command to download it. cd /tmp wget http://www.us.apache.org/dist/tomcat/tomcat-7/v7.0.54/bin/apache-tomcat-7.0.54.tar.gz 2. After competed download extract archive file in /tmp directory and move to proper location as per your need. We are placing this under /usr/local directory. tar xzf apache-tomcat-7.0.54.tar.gz mv apache-t...

Restful WADL WebService that serves the XML

In this tutorial, I am showing you how to develop a simple  RESTFUL web application that serves the XML request and response Jar files required : cxf-bundle-2.7.3.jar httpasyncclient-4.0-beta3.jar httpclient-4.2.1.jar httpcore-4.2.2.jar httpcore-nio-4.2.2.jar javax.ws.rs-api-2.0-m10.jar jaxb-impl-1.0.6.jar jettison-1.3.3.jar neethi-3.0.2.jar org-apache-commons-logging.jar xmlschema-core-2.0.jar 1. Creating a simple Bean class package com.student; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement (name = "Student" ) public class Student {   private String name ;   public String getName() {     return name ;   }   public void setName(String name ) {     this . name = name ;   } } 2.  Create a Web Service Endpoint Interface package com.student; public interface ChangeStudentDetails {   Student changeName(Stude...