3

I'm new to deployment process. Kindly advice me.

I have created a WAR file in my development machine. Then in the server machine, I have installed Tomcat which is clean and new. Then I copied the WAR file and placed it under webapps. Then I started the server, it worked.

Later I made few changes in the code and created WAR file and deployed the same in webapps folder. But it is not taking the latest changes.

I did in the following way

1. Stopped tomcat instance by shutdown.bat
2. Placed the new WAR file in webapps.
3. Started the tomcat instance by startup.bat

Still no changes are reflecting? What could be the reason?

Yakhoob
  • 559
  • 1
  • 12
  • 32
  • Have you tried the gui interface to load the war files – Vivek Singh Oct 04 '17 at 05:15
  • @VivekSingh, what makes the difference? – Yakhoob Oct 04 '17 at 05:17
  • @Yakoob Sometimes tomcat not able to load the war files automatically so you have to do it manually using GUI web interface. It happens several times to me. – Vivek Singh Oct 04 '17 at 05:19
  • @Yakoob I hope you know how to configure the tomcat manager and set the rules. – Vivek Singh Oct 04 '17 at 05:21
  • @VivekSingh, I added role for GUI and deployed again. But now the project itself is not running – Yakhoob Oct 04 '17 at 05:22
  • do you have tomcat set up to explode out the war file? when you navigate back into webapps do you see a directory with your project exploded out? – shinjw Oct 04 '17 at 05:24
  • @shinjw, I did not get your point. I see a directory of the project in my local system under wtpwebapps. But not in the server machine – Yakhoob Oct 04 '17 at 05:25
  • @Yakoob There might be some issue with the tomcat configuration. Can you share server and tomcat-user.xml file. It might be helpfull to understand the issue more clearly. – Vivek Singh Oct 04 '17 at 05:28
  • when you deploy an application by dropping in war file into the webapps directory... you'd need to make sure that your exploded project is cleaned *deleted* in other words when you're doing a manual deployment you would need to make sure that webapps is clean (with the exception of ROOT if you're using the web gui) – shinjw Oct 04 '17 at 05:29
  • @shinjw, it works when I delete the directory of the project under webapps. Then I place the new WAR file and deploy again. New changes are appearing now. – Yakhoob Oct 04 '17 at 05:31
  • just to confirm. did it work on the target machine? – shinjw Oct 04 '17 at 05:32
  • Possible duplicate of [How to deploy a war file in Tomcat 7](https://stackoverflow.com/questions/5109112/how-to-deploy-a-war-file-in-tomcat-7) – shinjw Oct 04 '17 at 05:33
  • @shinjw, yes it works in target machine. – Yakhoob Oct 04 '17 at 05:38

4 Answers4

3

Manual deploy: To deploy or redeploy a war file is simply dropping your war file into the $CATALINA_HOME/webapps directory of a Tomcat instance. If the server is running, the deployment will start instantly as Tomcat unpacks the archive.

If Tomcat is not running, then the server will deploy the project the next time it is started.

Sometimes you need to stop Tomcat and delete everything from $CATALINA_HOME/temp, $CATALINA_HOME/logs directories and delete the war and the related unpacked folder from $CATALINA_HOME/webapps directory. After that just copy your war to the right place and start Tomcat.

If the deployment is finished without error then you can see the following message in the tomcat log:

OK - Deployed application at context path /myapp

Otherwise an error message will appear which describes what was the error.

We need to see the Tomcat logfile if you need more help.

zappee
  • 20,148
  • 14
  • 73
  • 129
1

you should clear the log and temp files of tomcat

1

Try checking the autoDeploy flag in server.xml. Below is the description for this flag.

<Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="true">

autoDeploy

This flag value indicates if Tomcat should check periodically for new or updated web applications while Tomcat is running. If true, Tomcat periodically checks the appBase and xmlBase directories and deploys any new web applications or context XML descriptors found. Updated web applications or context XML descriptors will trigger a reload of the web application. The flag's value defaults to true.

Jaydeep Rajput
  • 3,605
  • 17
  • 35
-1

1)Please check your war file size. Then update it in the =apache-tomcat-9.0.53\webapps\manager\WEB-INF\web.xml file.

2)Remove dependency "javax.validation" from POM file

3)Add dependency org.glassfish.web

4)Check your log files. and modify dependencies accordingly.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – scandav Oct 17 '21 at 10:44