如何从同时在同一雄猫上运行的Web应用程序启动/停止应用程序 [英] How to start/stop an application from a webapplication running both on same tomcat

查看:60
本文介绍了如何从同时在同一雄猫上运行的Web应用程序启动/停止应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些帮助:我有两个在.tomcat 7上运行的.war文件,一个是Web应用程序,另一个是普通" Java应用程序.现在,我想弄清楚如何从Web应用程序启动/停止应用程序.两个应用程序都在同一个tomcat上.操作系统是Ubuntu 14.04.

I need some help: I have two .war files running on tomcat 7, one is a webapplication, the other one is just a "normal" java application. Now I want to figure out how to start/stop the application from my webapplication. Both applications are on the same tomcat. Operation system is Ubuntu 14.04.

感谢您的帮助

推荐答案

您可以在 server.xml 文件中进行配置,并放置2个服务:

you can configure that in your server.xml file and put 2 services :

<Service name="app1">
   <Connector port="8081" protocol="org.apache.coyote.http11.Http11NioProtocol" 
           connectionTimeout="20000" 
           redirectPort="8443" />
   <Engine name="Catalina" defaultHost="localhost">
      <Host name="localhost"  appBase="app1"
        unpackWARs="true" autoDeploy="true">
      </Host>
   </Engine>
</Service>
<Service name="app2">
   <Connector port="8082" protocol="org.apache.coyote.http11.Http11NioProtocol" 
           connectionTimeout="20000" 
           redirectPort="8443" />
   <Engine name="Catalina" defaultHost="localhost">
      <Host name="localhost"  appBase="app2"
        unpackWARs="true" autoDeploy="true">
      </Host>
   </Engine>
</Service>

然后该应用程序将运行在

Then the application will run on

    位于 http://localhost:8081 上的app1在 http://localhost:8082 上的
  1. app2
  1. app1 on http://localhost:8081
  2. app2 on http://localhost:8082

资源链接:

  1. 监听Tomcat中的多个端口
  2. 如何运行不同的应用程序在不同端口后面的单个Tomcat实例上?

这篇关于如何从同时在同一雄猫上运行的Web应用程序启动/停止应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆