-
1. Re: Injecting a classloader
jaikiran Jul 30, 2009 2:35 AM (in response to dmlloyd)Isn't it in
org.jboss.deployers.structure.spi.DeploymentUnit.getClassLoader();
Or are you looking for something else? -
2. Re: Injecting a classloader
dmlloyd Jul 30, 2009 11:47 AM (in response to dmlloyd)Yeah, that should work for the parent. Is there any way to find all the nested deployment units though? I see the *Component(String) methods however there does not seem to be a way to list what the components are.
-
3. Re: Injecting a classloader
dmlloyd Jul 30, 2009 11:49 AM (in response to dmlloyd)Ah, never mind that question, I see there's a visit() method. Now another question: do nested JARs which are just libraries qualify as deployment units? And, how can I get access to the DeploymentUnit instance from my deployer?
-
4. Re: Injecting a classloader
jaikiran Jul 31, 2009 1:06 AM (in response to dmlloyd)"david.lloyd@jboss.com" wrote:
do nested JARs which are just libraries qualify as deployment units?
No, they are not considered deployment units. Although i don't exactly know how such jars are represented or accessed from a deployment unit. Probably they end up as some kind of metadata? Ales?"david.lloyd@jboss.com" wrote:
And, how can I get access to the DeploymentUnit instance from my deployer?
Through your deployer, you tell the deployer framework about the deployment units you are interested in and the stage when you are interested in:public MyDeployer() { setInput(SomeMetadata.class); setStage(POST_CLASSLOADER); }
The deployer framework is then responsible for passing any such matching deployment units to the deploy(DeploymentUnit du) method of the deployer:/** * Deploy a deployment * * @param unit the unit * @throws DeploymentException for any error */ void deploy(DeploymentUnit unit) throws DeploymentException;
-
5. Re: Injecting a classloader
alesj Jul 31, 2009 10:27 AM (in response to dmlloyd)"jaikiran" wrote:
"david.lloyd@jboss.com" wrote:
do nested JARs which are just libraries qualify as deployment units?
No, they are not considered deployment units. Although i don't exactly know how such jars are represented or accessed from a deployment unit. Probably they end up as some kind of metadata? Ales?
Each nested jar in a jar is a sub-deployment.
Only jars in spec known locations are not considered as sub-deployments.
e.g. my.ear/lib/*.jar or my.war/WEB-INF/lib/*.jar
There might be more than one CL per app; e.g. ear with war.
It's the Module class that defines this.
Or what exactly are you looking for which DU::getClassLoader doesn't give you? -
6. Re: Injecting a classloader
jaikiran Jul 31, 2009 10:34 AM (in response to dmlloyd)"alesj" wrote:
Each nested jar in a jar is a sub-deployment.
Only jars in spec known locations are not considered as sub-deployments.
e.g. my.ear/lib/*.jar or my.war/WEB-INF/lib/*.jar
That's news to me. Thanks for clarifying :) By the way, where is this check/configuration done to see if the jar belongs to WEB-INF/lib or ear/lib? -
7. Re: Injecting a classloader
alesj Jul 31, 2009 10:40 AM (in response to dmlloyd)"jaikiran" wrote:
By the way, where is this check/configuration done to see if the jar belongs to WEB-INF/lib or ear/lib?
@ structure recognition phase.
e.g.
* WarStructure -> WEB-INF/lib
* EarStructure -> lib/ -
8. Re: Injecting a classloader
dmlloyd Jul 31, 2009 11:53 AM (in response to dmlloyd)Hmm, okay, it's starting to make sense. Essentially what I want is the ability for someone to put a jboss-logging.xml in their deployment unit somewhere, and if it contains a certain tag, then all that deployment unit's classloaders and children's classloaders will be registered with a callback that I specify somewhere.
It looks like I won't be able to use the simple BeanMetaDataFactory that I was using before to do this though - unless I can use "inject fromContext" somehow? -
9. Re: Injecting a classloader
alesj Jul 31, 2009 3:30 PM (in response to dmlloyd)"david.lloyd@jboss.com" wrote:
Hmm, okay, it's starting to make sense. Essentially what I want is the ability for someone to put a jboss-logging.xml in their deployment unit somewhere, and if it contains a certain tag, then all that deployment unit's classloaders and children's classloaders will be registered with a callback that I specify somewhere.
Perhaps you can make use of ModuleRegistry:
- http://anonsvn.jboss.org/repos/jbossas/projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/ModuleRegistry.java
where we would do incallback on it in ClassLoading:
- http://anonsvn.jboss.org/repos/jbossas/projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/ClassLoading.java
- http://anonsvn.jboss.org/repos/jbossas/branches/Branch_5_x/server/src/etc/conf/all/bootstrap/classloader.xml"david.lloyd@jboss.com" wrote:
It looks like I won't be able to use the simple BeanMetaDataFactory that I was using before to do this though - unless I can use "inject fromContext" somehow?
Why wouldn't you be able to use "inject fromContext"?
But I still fail to see what exactly you're trying to do. :-)