jboss 加载包顺序

本文详细解析了JBoss 4.2.3.GA版本中不同格式部署包的加载顺序,包括特定后缀如.deployer、.sar、.war等的加载规则,并介绍了如何通过配置文件调整这些顺序。此外,还探讨了EAR包内部组件的加载顺序。

经过测试得出,对ear包加载的顺序是按照包名的首个字母的顺序来加载的,如果在加载过程中出现包调用包的情况时,这样要注意包名引起的问题了。

问题:不同后缀的包的加载顺序是怎样?

         ear包内的jar包、war包的加载顺序又是怎样?

         包内的class文件以及其他文件的加载顺序又是怎样?

 

待续。。。。

 

 

对于问题的回答:

 

1、不同后缀的包的加载顺序是怎样?

答: 转:http://tanyankai.iteye.com/blog/569627

 

 

以下说到的版本是jboss-4.2.3.GA

并且假设JBoss安装在D:\Java\jboss-4.2.3.GA

JBoss部署的时候支持很多种格式打的包,比如说我们从deploy目录下面会看到有后缀名为deployer、sar,war,rar,xml ... (后来发现其实JBoss部署支持的格式,远远不止这些)

但是这些不同格式的应用是怎样的一个加载顺序呢?或者说有没有什么规律?带着这个疑问我在Jboss启动的时候仔细的看了一下命令行中的信息,发现两个信息:

1、  最先加载的是后缀名为deployer目录下应用或者服务;

2、  每次都会等有相同后缀名的应用(或者目录下的应用)完全加载完之后才会去加载另外一种后缀名

发现这两点之后,我就找了一下Jboss的一些配置文件,原来在D:\Java\jboss-4.2.3.GA\server\default\conf\xmdesc org.jboss.deployment.MainDeployer-xmbean.xml文件里面有这么一段内容:

 

 

 

<attribute access='read-write' setMethod='setEnhancedSuffixOrder' getMethod='getEnhancedSuffixOrder'>  
      <description>Allows the override of the suffix order declared by subdeployers, using the syntax [order:]suffix   
      </description>  
      <name>EnhancedSuffixOrder</name>  
      <type>[Ljava.lang.String;</type>  
      <!--   
         Statically set one or more enhanced suffix orders, independent of the value proposed by subdeployers.   
         Some deployers may also allow the suffixes/orders to be set locally, so that's preferable too.   
         For reference, this is the list of enhanced suffixes likely to be set by deployers (it may not   
         be completely up-to-date, or there can be user-defined deployers).   
            
         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   
            
         Until we resolve some startup issues, we'll setup some static enhanced suffix orders bellow   
         and leave the rest of the suffixes contributed dynamically by registering deployers.   
      -->  
      <descriptors>  
         <value value="250:.rar,300:-ds.xml,400:.jar,500:.war,550:.jse,650:.ear,800:.bsh"/>  
      </descriptors>  
   </attribute>  

 

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

 

<descriptors>  
     <value value="250:.rar,300:-ds.xml,400:.jar,500:.war,550:.jse,650:.ear,800:.bsh"/>  
</descriptors>  

 

 

 

 

问题2:ear包内的jar包、war包的加载顺序又是怎样?

答:经过测试,ear包内的包加载顺序,也是按照org.jboss.deployment.MainDeployer-xmbean.xml 这个文件设定的顺序来加载的。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值