Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 4 days 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 4 years ago)
- Default Branch: master
- Last Pushed: 2024-09-10T20:11:50.000Z (2 months ago)
- Last Synced: 2024-09-10T22:51:33.491Z (2 months ago)
- Topics: java, jetty, jsp, maven, root, tomcat, travis-ci, war
- Language: Java
- Homepage:
- Size: 2.47 MB
- Stars: 6
- Watchers: 3
- Forks: 48
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Maven](https://github.com/AndriyKalashnykov/tomcat-root-war/actions/workflows/build.yml/badge.svg)](https://github.com/AndriyKalashnykov/tomcat-root-war/actions/workflows/build.yml)
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FAndriyKalashnykov%2Ftomcat-root-war&count_bg=%2333CD56&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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 [email protected]: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 [email protected]: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/)
![index.html](images/http-8080-root.png)JSP - [http://localhost:8080/index.jsp](http://localhost:8080/index.jsp)
![infoservlet](images/http-8080-index-jsp.png)Servlet - [http://localhost:8080/infoservlet](http://localhost:8080/infoservlet)
![infoservlet](images/http-8080-infoservlet.png)HTML - [http://localhost:8080/index.html](http://localhost:8080/index.html)
![infoservlet](images/http-8080-index-html.png)## 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)