useJBossWebClassLoader in JBoss5

转useJBossWebClassLoader in JBoss5

版本 5   单击查看文档历史记录
创建于: 2009-5-14 上午7:35 作者  Adrian Brock  - 最后修改:  2009-11-9 上午8:32 作者  Ales Justin

Q: I set useJBossWebClassLoader=true in war-deployers-jboss-beans.xml but it doesn't work?

 

A: This parameter is no longer used in JBoss5. The "WarDeployer" no longer handles the classloading configuration for web apps. In fact, all war classloaders in JBoss5 are jboss classloaders.

 

What you need to do is change war's classloading configuration. There are at least two ways to do this:

 

1) Remove the WARClassLoaderDeployer

 

The WARClassLoaderDeployer automatically implements to the spec defined classloading rules for wars. That is each war gets its own scoped classloading domain where its classes are not visible to other applications (or any ear it is a part of) and the war's classes are looked at first. If you comment out the "WarClassLoaderDeployer" in deployers/jbossweb.deploy/META-INF/war-deployers-jboss-beans.xml then the war classloading will behave like any other deployer.

 

2) Define the classloading rules explicitly for the war

 

If you add a WEB-INF/jboss-classloading.xml with the following content to the war. Then you can define exactly how the war's classloader gets constructed. In this case, we put the war's classloader in the "DefaultDomain" which is shared with all other applications that don't define their

own domain. We also choose to look at all other classes exported by other applications "import-all" and to expose all our classes to other classes "export-all".

 

<?xml version="1.0" encoding="UTF-8"?>

 

<classloading xmlns="urn:jboss:classloading:1.0" 
              name="mywar.war" 
              domain="DefaultDomain"

 

<!-- A hack to make this classloader a top-level classloader
     The actual value is ignored since DefaultDomain
     already exists.
-->
              parent-domain="Ignored"

 

             export-all="NON_EMPTY" 
              import-all="true"> 
</classloading>

 

Note: there is an issue (see hack) with this 2nd approach for wars that are sub-deployments.

The fix is wip, JIRAs to follow:
https://jira.jboss.org/jira/browse/JBDEPLOY-222
https://jira.jboss.org/jira/browse/JBCL-125

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值