简体   繁体   English

如何配置性地禁止EAR文件中WAR文件的启动?

[英]How to inhibit start of WAR file within EAR file configuratively?

I have an ear file which contains 4 war files. 我有一个包含4个war文件的耳朵文件。 The main reason we put those together is, that the order of startup is important, and it is easier from a deployment perspective (the customer only gets one file and does not have to worry about which versions works together). 我们将它们放在一起的主要原因是,启动顺序很重要,并且从部署角度来看更容易(客户仅获得一个文件,而不必担心哪个版本可以一起工作)。

The ear files are going to be deployed on 4 different systems, which are a bit different, so on two of the servers one of the war apps doesn't even need to be started. 耳朵文件将部署在4个不同的系统上,这有所不同,因此甚至在两个服务器上都不需要启动其中一个war应用程序。

The runtime environment is JBOSS 4.2.2. 运行时环境为JBOSS 4.2.2。

Therefore my question is: What are my options to prevent the war file to be started, if I want to configure it via properties defined in properties-service.xml? 因此,我的问题是:如果要通过properties-service.xml中定义的属性进行配置,有哪些选项可以阻止启动war文件?

Another option, because the applications are actually spring applications, would be to prevent starting the ContextLoaderListener, but here I also haven't any idea how to do this via configuration. 另一个选择是因为应用程序实际上是春季应用程序,所以它会阻止启动ContextLoaderListener,但是这里我也不知道如何通过配置来执行此操作。

WAR files, which are embedded in an EAR file are not deployed as web applications unless they are defined as modules in the EAR's application.xml deployment descriptor. 除非将EAR文件中嵌入的WAR文件定义为EAR的application.xml部署描述符中的模块,否则它们不会部署为Web应用程序。 If you are using JBoss specific deployment descritors instead of the J2EE standard descriptors, you have to change the configuration there instead. 如果您使用的是JBoss特定的部署描述符,而不是J2EE标准描述符,则必须在此更改配置。

You can add list the war in META-INF/application.xml 您可以在META-INF / application.xml中添加列表战争

<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" version="5">

  <module>
    <web>
      <web-uri>war1.war</web-uri>
       <context-root>/war1</context-root> 
    </web>   
  </module>
  <module>
    <web>
      <web-uri>war2.war</web-uri>
      <context-root>/war2</context-root>
    </web>   
  </module>


  <library-directory>lib</library-directory>

</application>

The spring context in the unused war will not get started. 未使用的战争中的春天背景将不会开始。 You will get one spring applicaton context per war. 每次战争您将获得一个春季应用上下文。 (unless you use shared context) (除非您使用共享上下文)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM