简体   繁体   English

如何从命令行重新加载 Tomcat Java Server 应用程序?

[英]How to reload Tomcat Java Server application from command line?

我在重新编译 java servlet 文件后使用Tomcat Web 应用程序管理器重新加载 Tomcat 应用程序,有没有办法使用命令行重新加载应用程序?

I can think of a variety of ways to do this from the command line:我可以想到从命令行执行此操作的多种方法:

  1. Copy the new WAR file to the webapps folder, or just touch it.将新的 WAR 文件复制到 webapps 文件夹,或者直接触摸它。

  2. Use wget or curl to send the appropriate HTTP requests to the server's web management interface.使用 wget 或 curl 将适当的 HTTP 请求发送到服务器的 Web 管理界面。

  3. Use the "catalina.sh" script ... if you haven't installed tomcat as a service.使用“catalina.sh”脚本......如果你还没有安装tomcat作为服务。

  4. Run "/etc/init.d/tomcat restart" ... or however you restart a service on your system.运行 "/etc/init.d/tomcat restart" ... 或者你重新启动系统上的服务。


Note: I (too) have had difficulties in the past getting WAR file redeployment to work.注意:我(也)过去在重新部署 WAR 文件时遇到了困难。 When I'm doing Tomcat development, I tend to go for a full restart rather than redeploying individual servlets / WAR files.当我进行 Tomcat 开发时,我倾向于完全重启而不是重新部署单个 servlet/WAR 文件。


What is WAR file?什么是 WAR 文件?

Read this: http://en.wikipedia.org/wiki/WAR_file_format_%28Sun%29阅读: http : //en.wikipedia.org/wiki/WAR_file_format_%28Sun%29

I have a project symlink in /var/lib/tomcat7/webapps/app to my app directory and that's it and it work.我在 /var/lib/tomcat7/webapps/app 中有一个项目符号链接到我的应用程序目录,就是这样,它可以工作。

Bad idea, for a variety of reasons.坏主意,出于各种原因。 But if you insist, then I suggest trying approaches 2, 3 or 4 as described above.但是,如果您坚持,那么我建议您尝试上述方法 2、3 或 4。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从命令行获取 tomcat JAVA_OPTS? - how to get tomcat JAVA_OPTS from command line? 如何将数据从Android应用程序发送到Java Server(Apache tomcat)? - How to send data from Android application to Java Server(Apache tomcat)? 如何从 Java 应用程序中运行 elasticsearch 5.1 服务器(而不是通过命令行) - How to run elasticsearch 5.1 server from within Java application (not through command line) 如何为 tomcat 服务器上的多个 web 应用程序实例传递单个命令行 arguments - How to pass individual command line arguments for multiple web application instances on a tomcat server 从Java应用程序监视Tomcat服务器 - Monitor Tomcat server from java application 从命令行启动java应用程序时如何获取退出代码 - how to get exitcode when launching java application from command line 如何从命令行查询正在运行的Java应用程序? - How to query running java application from command line? 如何从命令行初始化应用程序的Java对象 - How to initialize an application's java object from command line 如何从Maven命令行远程调试Java应用程序 - How to remote debug java application from maven command line 如何从命令行运行Netbeans IDE Java桌面应用程序 - How to run Netbeans IDE Java Desktop Application from command line
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM