How to deploy war files to tomcat manually?

77,863

Solution 1

These are the steps I follow when I have to manually deploy a war in Tomcat on localhost:

  1. If Tomcat is running, stop/kill it.

  2. Go to the tomcat installation folder (this must be C:\Documents and Settings\tomcat6x for you), let's call it <tomcat>.

  3. In <tomcat>, delete the temp and work folders. They only contain temporary files.

  4. If it's a jar file maybe is for configuration, so drop it in <tomcat>/lib folder. If it's a war file, drop it in <tomcat>/deploy or in <tomcat>/webapps folder.

  5. Start your tomcat.

Solution 2

Put it in /WEB-INF/lib folder of the deployed webapp should work. For example : if you have webapp named myapp, then put your jar in webapps/myapp/WEB-INF/lib

Solution 3

Deploy web application : copy your war file to webapps directory inside tomcat.

(Make sure that your war file gets unpacked to create corresponding directory; If your tomcat is running then you don't need to do anything else. Tomcat will take care of it automatically.)

Deploying jar file can be done similar way by putting jar inside lib directory of your deployed application; but to reflect changes you might have to restart tomcat.

Share:
77,863
Patan
Author by

Patan

Updated on May 26, 2020

Comments

  • Patan
    Patan almost 4 years

    I have a war at location "C:\Documents and Settings\myProj.war".

    The web project is also available at "C:\Documents and Settings\myProj".

    I want to deploy this to one tomcat.

    location of the tomcat is "C:\Documents and Settings\tomcat6x".

    Please tell me how to do this manually or through command prompt.

    One application is already running in Tomcat. It is a maven project. I want to deploy another application on same tomcat which is not maven application.

  • Patan
    Patan about 11 years
    Thank you for the answer. my file is abcd.war. So I will copy and paste the war at "....\tomcat6x\webapps". Will it be sufficient. And I will restart the tomcat
  • Luiggi Mendoza
    Luiggi Mendoza about 11 years
    @User222 yes, that would be enough. If you want to deploy an application without restarting the whole server, use GlassFish or JBoss Web Application Servers.
  • Patan
    Patan about 11 years
    I had followed your tips. I pasted it in webapps folder after restarting the tomcat, I cannot see the war there. Its not getting reflected. when I browse that application, I am getting page not found error. Can you help what could have gone wrong
  • Luiggi Mendoza
    Luiggi Mendoza about 11 years
    @User222 first stop/kill tomcat, then copy your war in the <tomcat>/webapps folder, then start tomcat. If you have a jar, the webapps folder is not the right place to drop it. If that doesn't work for you, then drop the war in <tomcat>/deploy folder and when tomcat starts it will unpack the war and place it in <tomcat>/webapps for you
  • Luiggi Mendoza
    Luiggi Mendoza about 11 years
    @User222 please go to <tomcat>/logs and erase all the files there. Kill your tomcat process, place your war in the <tomcat>/webapps folder and start it. After doing it please go to <tomcat>/logs and copy the contents of the catalina.out (unix/linux env, for Windows OS check catalina.log) file in your question in order to analyze the deployment problem.
  • Admin
    Admin about 10 years
    Hey can anyone pl tell me how to start my deployed project from tomcat after copying myproj.war to webapps folder?
  • PriyaS
    PriyaS over 3 years
    After tomcat server is up, war folders should be auto created. But in my case they are not created. What to do ?
  • Luiggi Mendoza
    Luiggi Mendoza over 3 years
    @priyashukla Does this happen in a clean Tomcat installation? If it does, did you update any other configurations in your tomcat installation?