Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy war files to tomcat manually?

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.

like image 319
Patan Avatar asked Feb 20 '13 04:02

Patan


People also ask

How do I create a WAR file manually?

To create war file, you need to use jar tool of JDK. You need to use -c switch of jar, to create the war file. Go inside the project directory of your project (outside the WEB-INF), then write the following command: jar -cvf projectname.


3 Answers

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.

like image 50
Luiggi Mendoza Avatar answered Sep 21 '22 04:09

Luiggi Mendoza


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

like image 30
Iswanto San Avatar answered Sep 21 '22 04:09

Iswanto San


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.

like image 30
rai.skumar Avatar answered Sep 22 '22 04:09

rai.skumar