javaapachetomcatwardeploying

war file not deploying in Tomcat


I have a war file which i want to deploy in my system on tomcat .What I've so far is 1.Shutdown my tomcat from cmd.

2.Set environment variables "C:\Program Files\Java\jdk1.7.0_51" and "%CATALINA_HOME%/bin" .

3.Set appBase="webapps" ,autoDeploy="true", name="localhost", unpackWARs="true" in server.xml .

4.Copy the war file into "C:\apache-tomcat-7.0.77\webapps\MyProject" .

5.Restart tomcat using cmd.

                        After doing all this steps the log I got from catalina.log is

"INFO: Deploying web application directory C:\apache-tomcat-7.0.77\webapps\MyProject Jun 07, 2017 4:50:19 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deployment of web application directory C:\apache-tomcat-7.0.77\webapps\MyProject has finished in 188 ms Jun 07, 2017 4:50:19 PM org.apache.catalina.startup.HostConfig deployDirectory"

                       It seems like MyProject is deployed without any error but when I try to access it using the url http://localhost:8084/MyProject/ the browser shows 

HTTP Status 404 - /MyProject/

type Status report

message /MyProject/

description The requested resource is not available.

Apache Tomcat/7.0.77 My tomcat is running fine when i go to the url http://localhost:8084(8080 is the default port of tomcat but i changed it to 8084)


Solution

  • 4.Copy the war file into "C:\apache-tomcat-7.0.77\webapps\MyProject" .

    You should put your war file to C:\apache-tomcat-7.0.77\webapps\ instead.

    Tomcat will then automatically unpack (into a directory named after a war file) and deploy it.

    If you create a webapp sub-folder yourself, Tomcat thinks that it is an already unpacked webapp (with a single .war binary file inside it), and deploys it, but as it is virtually empty (aside the .war archive file), you get 404 while trying to access it.