Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

deploy war file in tomcat server

Tags:

I have copied the sample.war file in webapps directory of tomcat.

I can acess localhost:8080.

deploying of wars is automatic by default -i have checked my webapps folder for an extracted folder "sample"

but it is not extracted.why the war file is doesn't extracted.please give me solution for this.

like image 617
user1796222 Avatar asked Nov 09 '12 03:11

user1796222


People also ask

How can I deploy WAR file in Tomcat?

Perhaps the simplest way to deploy a WAR file to Tomcat is to copy the file to Tomcat's webapps directory. Copy and paste WAR files into Tomcat's webapps directory to deploy them. Tomcat monitors this webapps directory for changes, and if it finds a new file there, it will attempt to deploy it.

What happens when we deploy a WAR file in Tomcat?

Java web applications are usually packaged as WAR files for deployment. These files can be created on the command line or with an IDE, like Eclipse. After deploying the WAR file, Tomcat unpacks it and stores all the project files from the webapps directory in a new directory named after the project.


2 Answers

Delete that war file from webapps/ directory. Then open link http://localhost:8080/ in your web browser. Click Tomcat Manager then enter user name and password. In next page you can see one option called "WAR file to deploy". Select your war file from there and click "deploy" button.

If you want auto deployment when you copy files to webapp/ directory. Then make sure that you server.xml file contains the following values:

autoDeploy="true"
unpackWARs="true"

Just search these values in your server.xml file and edit values as shown above

For more info see Deploy A New Application from a Local Path.

like image 144
Fathah Rehman P Avatar answered Oct 26 '22 06:10

Fathah Rehman P


In general this happens when you have 2 Tomcats. If CATALINA_HOME is referring to Tomcat-A and you are trying to run Tomcat-B from Tomcat-B/bin/startup.bat. It will run Tomcat-A. Hence your war which you are trying to deploy in Tomcat-B will not be extracted as Tomcat-A is running in actual.

like image 36
Heisenberg Avatar answered Oct 26 '22 06:10

Heisenberg