Search This Blog

Saturday, 13 February 2021

Deploy a sample war file into tomcat

 Step 1) Stop tomcat instance

[osboxes@tomcathost:/home/osboxes/instances/poc-tomcat-instance/bin]#pwd
/home/osboxes/instances/poc-tomcat-instance/bin

[osboxes@tomcathost:/home/osboxes/instances/poc-tomcat-instance/bin]#./shutdown.sh

Using CATALINA_BASE:   /home/osboxes/instances/poc-tomcat-instance
Using CATALINA_HOME:   /home/osboxes/products/tomcat/tomcat90
Using CATALINA_TMPDIR: /home/osboxes/instances/poc-tomcat-instance/temp
Using JRE_HOME:        /home/osboxes/products/jdk/jdk_latest/jre
Using CLASSPATH:       /home/osboxes/products/tomcat/tomcat90/bin/bootstrap.jar:/home/osboxes/instances/poc-tomcat-instance/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Using CATALINA_PID:    /home/osboxes/logs/poc-tomcat-instance/jvm.pid
Tomcat stopped.

Step 2) Download and place the war file in to tomcat webapps directory

[osboxes@tomcathost:/home/osboxes/instances/poc-tomcat-instance/webapps]#pwd

/home/osboxes/instances/poc-tomcat-instance/webapps


[osboxes@tomcathost:/home/osboxes/instances/poc-tomcat-instance/webapps]#wget https://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/sample.war

--2021-02-13 03:06:19--  https://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/sample.war
Resolving tomcat.apache.org (tomcat.apache.org)... 2a01:4f9:2a:1a61::2, 95.216.26.30, 207.244.88.140
Connecting to tomcat.apache.org (tomcat.apache.org)|2a01:4f9:2a:1a61::2|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4606 (4.5K)
Saving to: ‘sample.war’
sample.war                              100%[============================================================================>]   4.50K  --.-KB/s    in 0s
2021-02-13 03:06:19 (39.2 MB/s) - ‘sample.war’ saved [4606/4606]
[osboxes@tomcathost:/home/osboxes/instances/poc-tomcat-instance/webapps]#

Step 3) Start tomcat instance

[osboxes@tomcathost:/home/osboxes/instances/poc-tomcat-instance/webapps]#cd ../bin/

[osboxes@tomcathost:/home/osboxes/instances/poc-tomcat-instance/bin]#./startup.sh

Using CATALINA_BASE:   /home/osboxes/instances/poc-tomcat-instance
Using CATALINA_HOME:   /home/osboxes/products/tomcat/tomcat90
Using CATALINA_TMPDIR: /home/osboxes/instances/poc-tomcat-instance/temp
Using JRE_HOME:        /home/osboxes/products/jdk/jdk_latest/jre
Using CLASSPATH:       /home/osboxes/products/tomcat/tomcat90/bin/bootstrap.jar:/home/osboxes/instances/poc-tomcat-instance/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Using CATALINA_PID:    /home/osboxes/logs/poc-tomcat-instance/jvm.pid
Tomcat started.

Step 4) Access the application running on tomcat

[osboxes@tomcathost:/home/osboxes/instances/poc-tomcat-instance/bin]#curl -Ik http://tomcathost:8080/sample
HTTP/1.1 302
Location: /sample/
Transfer-Encoding: chunked
Date: Sat, 13 Feb 2021 08:08:56 GMT




No comments: