Apache Tomcat is one of the most popular web servers used by developers to deploy war files. In this post we are going to see how to setup tomcat management console, local deploy, deploy using maven(lab 2), deploy a jsp file with required jar files(lab 3).
Download apache tomcat from the link. Your system should have java pre-installed.
Unzip the tomcat file and you can see bin, conf, lib , logs, webapps folder.
The bin folder which has the start and shutdown scripts and some jar files for the tomcat to get started.
The conf folder where you can edit the server port, management console enable.
The logs which gives the tomcat logs and the webapps where you need to deploy your WAR file.
Change the tomcat server port.
Open tomcat directoryconfserver.xml and change the port from 8080 to 9080.
<Connector port="8080" protocol="HTTP/1.1"connectionTimeout="20000" redirectPort="8443" />
Open tomcat directoryconftomcat-users.xml and add the following before </tomcat-users> tag.
<role rolename="manager-gui"/> <role rolename="manager-script"/> <user username="admin" password="password" roles="manager-gui, manager-script"/>
save the file.
Start the tomcat
Open bin folder in command prompt. Type startup.bat to start the tomcat.
Deploy a WAR file
Type localhost:8080/manager, it will ask for the user name and password(check the above configure roles paragraph). After successfully login, you will get the below page to manual deploy the war file.
Another way to deploy a war file is to stop tomcat.
Go to tomcat directorywebapps, put the war in that path. start the tomcat. Open browser and type localhost:port/nameofyourwarfile.