Wednesday 24 October 2012

Deployment in Tomcat Apache Server


  1. Export the project in WAR file by selecting the project to deploy -> Export -> WAR file

    Select Project > Export >  WAR file
    Export project as WAR
  2. There are two ways to deploy WAR file in Apache Tomcat Server.First is through tomcat manager.The steps to deploy WAR from tomcat manager is described below:-
    1.            Open tomcat-users.xml present at  appBase location(default appBase is "$CATALINA_BASE)/config or from eclipse go to server >Tomcat v6.0 Server at localhost-config and add user with manager role.For Ex:- Add the following line
      <user username="admin" password="admin" roles="manager"/>

      tomcat-users.xml
      tomcat_users.xml
    2. Start the tomcat server by executing startup.bat file present at bin folder of apache-tomcat.Open the Apache Manager by clicking http://localhost:8080 and select Tomcat Manager.   
      http://localhost:8080/
      Apache tomcat manager
      Enter user name and password created using tomcat-users.xml.For our case it will be :-

      Username = “admin”

      Password=”admin"
    3. Upload WAR file as shown below.
      Add WAR file
      Add WAR file

  3. Deployment on Tomcat startup
    1. The location you deploy web applications to for this type of deployment is called the appBase which is specified per Host. Copy the WAR file to be deployed to appBase location.(default appBase is "$CATALINA_BASE/webapps").This method will work only if Host's deployOnStartup attribute is "true".