Tomcat not autodeploying war file

前端 未结 6 1264
隐瞒了意图╮
隐瞒了意图╮ 2021-01-31 08:56

I followed the following steps

  • Shutdown Tomcat
  • Deployed a war file with a timestamp of 1st December
  • Start Tomcat - This created the exploded dire
相关标签:
6条回答
  • 2021-01-31 09:30

    Historically, tomcat has never updated the exploded directory when you just drop in a new jar, at least for me. I always assumed this to be a bug, but never looked into it as there is a simple solution. Both of these should work fine:

  • Deploy the war file using the build-in Manager application. Fine if you are ok with using a GUI for production administration. Note This tool used to have issues if you deployed multiple times (again, I never delved into the details), but a Tomcat restart worked fine.
  • Stop, Delete, and Drop. Stop Tomcat, delete the exploded directory, drop in the new war file.
0 讨论(0)
  • 2021-01-31 09:30

    As I use maven to generate my builds in tomcat inside a ubuntu box, I have a script called

    install_wars.sh

    With the following content:

    mvn clean install
    service tomcat7 stop
    find /var/lib/tomcat7/webapps/ -mindepth 1 -maxdepth 1 -type d -exec rm -rf {} \;
    find . -name *.war -exec cp {} /var/lib/tomcat7/webapps/ \;
    service tomcat7 start
    

    You may want to change the path and maven commands accordingly.

    The tomcat stop/start are there to avoid any memory leaks that can make the application slow after several redeploys.

    0 讨论(0)
  • 2021-01-31 09:38

    Yes the exploded directory ought to be updated, however you don't need to stop Tomcat for this to work - it will work with Tomcat running. Can you try it again without stopping Tomcat in between the update?

    Also I use the built-in Manager application which allows me to update war files anywhere in the domain without being root (or apache or whatever tomcat is running as). This is very convenient and can be built into an Ant script.

    0 讨论(0)
  • 2021-01-31 09:52

    I usually set the autodeploy in server.xml to false. This allows me to drop the new war and restart tomcat without having to deal with the corresponding directory.

    0 讨论(0)
  • 2021-01-31 09:53

    In my case i name artifact

    ROOT.WAR
    

    but should be

    ROOT.war
    

    Cheers!

    0 讨论(0)
  • 2021-01-31 09:55

    Add autoDeploy = true. Works for me

    <Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="true">
    
    0 讨论(0)
  • 提交回复
    热议问题