开发者

How to prevent JBoss inter web application classpath?

开发者 https://www.devze.com 2023-02-07 07:11 出处:网络
I have two web application deployed in JBoss within same server. I have observed classpath is shared between this two web applications.

I have two web application deployed in JBoss within same server. I have observed classpath is shared between this two web applications.

So how do I prevent classpath saring betw开发者_开发问答een applications. I mean whatever classes and jar files available in one application should not be visible in another application in same server in jboss.


For most versions of jBoss AS you need to update your jboss-web.xml file:

<jboss-web>
   <class-loading> 
      <loader-repository>com.example:archive=unique-archive-name</loader-repository> 
   </class-loading>
</jboss-web>

See the following reference for more info:

  • jBoss class loading configuration
  • jBoss class loading background & use cases


The JBoss wiki states:

In jboss-3.2.3, the jbossweb-tomcat41.sar is configured to use a unified class loader as the web application class loader. This is controlled by the UseJBossWebLoader attribute in the jbossweb-tomcat41.sar/META-INF/jboss-service.xml descriptor. The use of a unified class loader means that the classes available in the war inside of the WEB-INF/classes and WEB-INF/lib are incorporated into the default shared class loader repository. This may not be what you want as its contrary to the default servlet 2.3 class loading model and can result in sharing of classes/resources between web applications. You can disable this by setting this attribute to false.

It goes on to say that this behaviour was changed in 4.0.2, so it is a reasonable assumption that you still need to do this in 4.0.1.

0

精彩评论

暂无评论...
验证码 换一张
取 消