How do I update a Tomcat webapp without restarting the entire service?

前端 未结 3 1980
迷失自我
迷失自我 2020-11-28 19:00

I\'m new to Tomcat. We have a dev machine with about 5 apps running. Even though it\'s dev, it\'s used by our clients pretty heavily during testing.

S

相关标签:
3条回答
  • 2020-11-28 19:04

    Have you tried to use Tomcat's Manager application? It allows you to undeploy / deploy war files with out shutting Tomcat down.

    If you don't want to use the Manager application, you can also delete the war file from the webapps directory, Tomcat will undeploy the application after a short period of time. You can then copy a war file back into the directory, and Tomcat will deploy the war file.

    If you are running Tomcat on Windows, you may need to configure your Context to not lock various files.

    If you absolutely can't have any downtime, you may want to look at Tomcat 7's Parallel deployments You may deploy multiple versions of a web application with the same context path at the same time. The rules used to match requests to a context version are as follows:

    • If no session information is present in the request, use the latest version.
    • If session information is present in the request, check the session manager of each version for a matching session and if one is found, use that version.
    • If session information is present in the request but no matching session can be found, use the latest version.
    0 讨论(0)
  • 2020-11-28 19:10

    There are multiple easy ways.

    1. Just touch web.xml of any webapp.

      touch /usr/share/tomcat/webapps/<WEBAPP-NAME>/WEB-INF/web.xml
      

    You can also update a particular jar file in WEB-INF/lib and then touch web.xml, rather than building whole war file and deploying it again.

    1. Delete webapps/YOUR_WEB_APP directory, Tomcat will start deploying war within 5 seconds (assuming your war file still exists in webapps folder).

    2. Generally overwriting war file with new version gets redeployed by tomcat automatically. If not, you can touch web.xml as explained above.

    3. Copy over an already exploded "directory" to your webapps folder

    0 讨论(0)
  • 2020-11-28 19:11

    In conf directory of apache tomcat you can find context.xml file. In that edit tag as <Context reloadable="true">. this should solve the issue and you need not restart the server

    0 讨论(0)
提交回复
热议问题