-
1. Re: Classloaders: How to hide classes from the DefaultDomain?
alesj Feb 10, 2010 3:50 PM (in response to gcompienne)1 of 1 people found this helpfulUntil JBossAS itself is fully OSGi-zed, you'll have to create such DefaultDomain-replacement manually/programatically.
Then all other deployments can referece it.
It should be trivial to create such domain, as the api is very simple.
This might help you:
* http://java.dzone.com/articles/jboss-microcontainer-classloading
This can be a simple service dropped into deployers/ dir - so it's deployed before any real deployment in deploy/.
-
2. Re: Classloaders: How to hide classes from the DefaultDomain?
gcompienne Feb 11, 2010 1:20 PM (in response to alesj)Ok, I have applied what is described in the JavaLobby document. So I have created a separate JAR with a single bean, which I use to create the domain "JavaDomain".
public JavaDomainCreator() {
log.info("Starting JavaDomainCreator.");
clSystem = ClassLoaderSystem.getInstance();
log.info("CLS = " + clSystem);
clDomain = clSystem.createAndRegisterDomain("JavaDomain");
}Then, I have changed the classloader deployment descriptor for my application jar in order to make it use the "JavaDomain" as a parent:
<classloading domain="InfinispanCacheDomain" xmlns="urn:jboss:classloading:1.0"
import-all="false" parent-first="false" parent-domain="JavaDomain" top-level-classloader="true">
<requirements>
<package name="test.api"/>
</requirements>
<capabilities>
<package name="test.service.infinispan_impl"/>
</capabilities>
</classloading>Now, I can see that my classloader has no visibility of the things that are inside the "/jboss-5.1.0.GA/server/zzz" folder. It still has visibility of the "/jboss-5.1.0.GA/lib", but I suspect this is because these are made part of the bootstrap classpath (which is fine with me, but still something to keep in mind).
Now I need to check how I can get this to work in a single JAR file (issue that I need to create the Domain before the "jboss-classloader.xml" probably becomes active), but hopefully I will not have too many issues.
Thanks for your help.
Regards,
Gilles.