- Building Web Apps with Spring 5 and Angular
- Ajitesh Shukla
- 459字
- 2021-07-02 19:38:22
Installing/configuring the Apache Tomcat server
One can skip this section when working with a Spring Boot project. This is because starting a Spring boot application, using public static void main as an entry point, launches an embedded web server and, thus, one would not require starting a server such as Tomcat.
In this section, we will learn about some of the following:
- How to install and configure the Apache Tomcat server
- Common deployment approaches with the Tomcat server
- How to add the Tomcat server in Eclipse
The Apache Tomcat software is an open-source implementation of the Java servlet, JavaServer Pages (JSPs), Java Expression Language, and Java WebSocket technologies. We will work with Apache Tomcat 8.x version in this book. We will look at both, the Windows and Unix version of Java. One can go to http://tomcat.apache.org/ and download the appropriate version from this page. At the time of installation, it requires you to choose the path to one of the JREs installed on your computer. Once the installation is complete, the Apache Tomcat server is started as a Windows service. With the default installation options, one can then access the Tomcat server by accessing the URL http://127.0.0.1:8080/.
A page such as the following will be displayed:

The following is what the Tomcat's folder structure looks like:

In the preceding image, note the webapps folder which will contain our web apps. The following description uses variable names such as the following:
- $CATALINA_HOME: The directory into which Tomcat is installed.
- $CATALINA_BASE: The base directory against which most relative paths are resolved. If you have not configured Tomcat for multiple instances by setting a CATALINA_BASE directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME.
The following are the most commonly used approaches to deploy web apps in Tomcat:
- Copy the unpacked directory hierarchy into a subdirectory in the directory $CATALINA_BASE/webapps/. Tomcat will assign a context path to your application based on the subdirectory name you choose.
- Copy the web application archive (WAR) file into the directory $CATALINA_BASE/webapps/. When Tomcat is started, it will automatically expand the web application archive file into its unpacked form, and execute the application that way. Simply speaking, be it an HTML page/folder or WAR package, copying it inside the webapps and starting the Tomcat server will extract the war to a folder. Thus, it is important that after copying the war file to the webapps folder, you restart the Tomcat server.
Let us learn how to configure Apache Tomcat from within Eclipse. This would be very useful, as you could start and stop Tomcat from Eclipse while working with your web applications.
- OpenCV實(shí)例精解
- 基于差分進(jìn)化的優(yōu)化方法及應(yīng)用
- Mastering Julia
- Visual C++應(yīng)用開發(fā)
- iOS編程基礎(chǔ):Swift、Xcode和Cocoa入門指南
- 單片機(jī)C語(yǔ)言程序設(shè)計(jì)實(shí)訓(xùn)100例
- Bootstrap for Rails
- 小程序從0到1:微信全棧工程師一本通
- 零基礎(chǔ)學(xué)C++(升級(jí)版)
- 微服務(wù)設(shè)計(jì)
- PhoneGap 3.x Mobile Application Development Hotshot
- Effective Python:編寫高質(zhì)量Python代碼的90個(gè)有效方法(原書第2版)
- 軟件測(cè)試
- Hands/On Microsoft Teams
- Kendo UI Cookbook