https://github.com/andriykalashnykov/tomcat-root-war
Java Web Application example to replace Tomcat's default ROOT application
https://github.com/andriykalashnykov/tomcat-root-war
java jetty jsp maven root tomcat travis-ci war
Last synced: 6 months ago
JSON representation
Java Web Application example to replace Tomcat's default ROOT application
- Host: GitHub
- URL: https://github.com/andriykalashnykov/tomcat-root-war
- Owner: AndriyKalashnykov
- License: mit
- Created: 2020-04-17T16:50:13.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-03-19T23:16:48.000Z (7 months ago)
- Last Synced: 2025-04-18T23:46:01.101Z (6 months ago)
- Topics: java, jetty, jsp, maven, root, tomcat, travis-ci, war
- Language: Java
- Homepage:
- Size: 2.47 MB
- Stars: 6
- Watchers: 2
- Forks: 61
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/AndriyKalashnykov/tomcat-root-war/actions/workflows/build.yml)
[](https://hits.seeyoufarm.com)
[](https://opensource.org/licenses/MIT)
# Java Web Application exampleROOT.war replaces Tomcat's default ROOT application - $TOMCAT_HOME/webapps/ROOT
## Pre-requisites
* [sdkman](https://sdkman.io/install)
Install and use JDK 18
```bash
sdk install java 18.0.2-tem
sdk use java 18.0.2-tem
```
* [Apache Maven](https://maven.apache.org/install.html)Install Apache Maven 3.9.9
```bash
sdk install maven 3.9.9
sdk use maven 3.9.9
```
* [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)## Test with Jetty web server
```shell
git clone git@github.com:AndriyKalashnykov/tomcat-root-war.git
cd tomcat-root-war
mvn clean package jetty:runxdg-open http://localhost:8080/index.html
```Access http://localhost:8080/index.html or see [Tomcat ROOT WAR Web Application UI](https://github.com/AndriyKalashnykov/tomcat-root-war/blob/master/README.md#java-web-application-ui)
## Create WAR file
```shell
git clone git@github.com:AndriyKalashnykov/tomcat-root-war.git
cd tomcat-root-war
mvn clean install
```### Building WAR in a Secure environmets that enforce SSL
```shell
mvn clean install -Daether.connector.https.securityMode=insecure -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true
```## List content of generated WAR file
```shell
jar tf ./target/ROOT.war
```
## Replace TOMCAT ROOT applicationEdit `$TOMCAT_HOME/conf/server.xml`: `autoDeploy` and `deployOnStartUp` needs to be set to `false`
```xml
```
Remove default ROOT folder and copy ROOT.war
```shell
rm -rf $TOMCAT_HOME/webapps/ROOT/
rm -f $TOMCAT_HOME/webapps/ROOT.war
cp ./target/ROOT.war $TOMCAT_HOME/webapps/ROOT.war
```### Tomcat ROOT WAR Web Application UI
Default welcome page - [http://localhost:8080/](http://localhost:8080/)
JSP - [http://localhost:8080/index.jsp](http://localhost:8080/index.jsp)
Servlet - [http://localhost:8080/infoservlet](http://localhost:8080/infoservlet)
HTML - [http://localhost:8080/index.html](http://localhost:8080/index.html)
## This project used in
* [Java Web Application (WAR) deployed as root "/" context onto Customized Bitnami Tomcat 9](https://github.com/AndriyKalashnykov/bitnami-tomcat9-jdk18-root-war)
* [Docker image of this application deployed onto Customized Bitnami Tomcat 9](https://hub.docker.com/r/andriykalashnykov/bitnami-tomcat9-jdk18-root-war)