Reputation: 2423
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 between applications. I mean whatever classes and jar files available in one application should not be visible in another application in same server in jboss.
Upvotes: 2
Views: 2027
Reputation: 98210
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:
Upvotes: 1
Reputation: 108879
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 thejbossweb-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 theWEB-INF/classes
andWEB-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.
Upvotes: 0