We are going to package our project and then close Eclipse. We will manually configure the configuration files of Apache Tomcat to create a user who has access to the Manager App and increase the default size of the deployable applications. We will initiate Apache Tomcat and, through a web browser, start the Manager App. Within the Manager App, we will select the project we packaged earlier and deploy it so that we can execute our app in a standalone way. The steps to do this are as follows:
/home/user/prd5Ch14.war
.We will now create a user who can access the Manager App. To do so, we will edit the file [TOMCAT_HOME]/conf/tomcat-users.xml
, delete its current contents, and copy the following code:
<?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="tomcat"/> <role rolename="manager-gui"/> <user username="tomcat" password="password" roles="tomcat,manager-gui"/> </tomcat-users>
Here we are defining a user with a username
called tomcat
and a password
with the value password
, as well as giving him/her the roles tomcat
and manager-gui
; this last role is the one needed to access the Manager App.
We will save the changes to continue.
web.xml
by going to [TOMCAT_HOME]/webapps/manager/WEB-INF
, search for the section under the tag <multipart-config>
, and edit it in the following way:<multipart-config> <!-- 150MB max --> <max-file-size>157286400</max-file-size> <max-request-size>157286400</max-request-size> <file-size-threshold>0</file-size-threshold> </multipart-config>
By doing so, we will have established a maximum size of 150 MB (157,286,400 bytes). We will save the changes to continue.
shell> cd [TOMCAT_HOME]/bin
shell> sh startup.sh
shell> cd [TOMCAT_HOME]in
shell> startup.bat
http://localhost:8080
and select the option Manager App as shown in the following screenshot:We will then log in using the previously defined user (username: tomcat
and password: password
).
prd5Ch14.war
(which we created in step 1) and then click on the Deploy button as shown in the following screenshot:Once the deployment has finished, we will see that our application has now been added to the Applications section as shown in the following screenshot:
We are now ready to access our application through the following URL: http://localhost:8080/prd5Ch14
.
We created the package prd5Ch14.war
so that it contains our project and then closed Eclipse. We manually configured Apache Tomcat's tomcat-users.xml
file and added the user tomcat
with the necessary permissions to access the Manager App. We also configured the file web.xml
to increase the maximum size of the applications that are deployed on Apache Tomcat; we set this value to 150 MB. After performing the said configurations, we initiated Apache Tomcat and used a web browser to access the URL http://localhost:8080
; once there, we entered the Manager App and logged in using the user tomcat
. We then headed to the Deploy section, selected the file prd5Ch14.war
, and proceeded with the deployment of our application.
Next, we will invite you to employ the knowledge you have acquired through this chapter to execute another PRD report in a standalone way.
The steps you should use are roughly the following:
Q1. Which of the following statements are true?