Restart tomcat through webapp

后端 未结 3 1806
眼角桃花
眼角桃花 2021-01-14 05:13

I have a crazy request about restarting tomcat server through my webapp. I was searching for nearly 2 days about this and all i found are executing external batch file or ca

相关标签:
3条回答
  • 2021-01-14 05:42

    Why not just create a script an call it trough Runtime.exec? Seems quite optimal to me. Since restarting tomcat will terminate the Java VM, it doesn't really make sense to have it as an API call.

    0 讨论(0)
  • 2021-01-14 05:49

    You can connect to the shutdown port tomcat opens and issue the shutdown command.
    See http://tomcat.apache.org/tomcat-7.0-doc/config/server.html

    0 讨论(0)
  • 2021-01-14 05:49

    Best solution we have found is to use the Java Service Wrapper

    It provides multiple benefits in managing the lifecyle of your server - including what you are trying to achieve - and in particular the ability to easily register as a Windows service.

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