JBoss启动时加载应用程序的顺序

转自:http://tanyankai.javaeye.com/blog/569627

Html代码 
  1. 以下说到的版本是jboss-4.2.3.GA  
  2.   
  3. 并且假设JBoss安装在D:\Java\jboss-4.2.3.GA  
  4.   
  5. JBoss部署的时候支持很多种格式打的包,比如说我们从deploy目录下面会看到有后缀名为deployer、sar,war,rar,xml ... (后来发现其实JBoss部署支持的格式,远远不止这些)  
  6.   
  7. 但是这些不同格式的应用是怎样的一个加载顺序呢?或者说有没有什么规律?带着这个疑问我在Jboss启动的时候仔细的看了一下命令行中的信息,发现两个信息:  
  8.   
  9. 1、  最先加载的是后缀名为deployer目录下应用或者服务;  
  10.   
  11. 2、  每次都会等有相同后缀名的应用(或者目录下的应用)完全加载完之后才会去加载另外一种后缀名  
  12.   
  13. 发现这两点之后,我就找了一下Jboss的一些配置文件,原来在D:\Java\jboss-4.2.3.GA\server\default\conf\xmdesc org.jboss.deployment.MainDeployer-xmbean.xml文件里面有这么一段内容:  

 

Xml代码 
  1. <attribute access='read-write' setMethod='setEnhancedSuffixOrder' getMethod='getEnhancedSuffixOrder'>  
  2.       <description>Allows the override of the suffix order declared by subdeployers, using the syntax [order:]suffix  
  3.       </description>  
  4.       <name>EnhancedSuffixOrder</name>  
  5.       <type>[Ljava.lang.String;</type>  
  6.       <!--  
  7.          Statically set one or more enhanced suffix orders, independent of the value proposed by subdeployers.  
  8.          Some deployers may also allow the suffixes/orders to be set locally, so that's preferable too.  
  9.          For reference, this is the list of enhanced suffixes likely to be set by deployers (it may not  
  10.          be completely up-to-date, or there can be user-defined deployers).  
  11.            
  12.          050:.deployer,050:-deployer.xml,100:.aop,100:-aop.xml,150:.sar,150:-service.xml,200:.  ,250:.rar,300:-ds.xml,350:.har,400:.jar,400:.ejb3,400:.par,500:.war,600:.wsr,650:.ear,700:.jar,750:.zip,800:.bsh,900:.last  
  13.            
  14.          Until we resolve some startup issues, we'll setup some static enhanced suffix orders bellow  
  15.          and leave the rest of the suffixes contributed dynamically by registering deployers.  
  16.       -->  
  17.       <descriptors>  
  18.          <value value="250:.rar,300:-ds.xml,400:.jar,500:.war,550:.jse,650:.ear,800:.bsh"/>  
  19.       </descriptors>  
  20.    </attribute>  

 

 

 

 

 

Html代码 
  1. 如果我们需要在JBoss下面部署很多应用,并且有些时候这些应用相互之间需要有先后启动顺序,我们可以通过以下两种方式做到。  
  2. 1、  根据实际需要,部署到不同的子目录下面  
  3. 2、  通过修改下面value值来改变JBoss默认加载顺序  

 

Xml代码 
  1. <descriptors>  
  2.      <value value="250:.rar,300:-ds.xml,400:.jar,500:.war,550:.jse,650:.ear,800:.bsh,850:.deployer"/>  
  3. </descriptors>  
原文地址:https://www.cnblogs.com/oisiv/p/1961460.html