"kabir.khan(a)jboss.com" wrote :
| Some code in GenericBeanAspectFactory.doCreate() handled that scenario and pushed the
correct loader to use into the underlying GenericBeanFactory.
|
How did this work? I don't see anything in the previous GBF code that allowed you
to override the classloader (other than the metadata).
anonymous wrote : However, now the underlying GenericBeanFactory will always use the
loader of its KernelControllerContext to create the bean instance, so in the case outlined
the wrong loader is used to create the bean.
|
This hasn't changed. All that changed is that this retrieval is now in a privileged
block.
Asking the controller context essentially asks the ClassLoaderMetaData
if it has one (otherwise it uses the TCL),
which will be coming from whatever you setup in the deployer.
AbstractAopMetaDataDeployer
| private void deploy(FakeComponentUnit unit, BeanMetaData deployment) throws
DeploymentException
| {
| // No explicit classloader, use the deployment's classloader
| if (deployment.getClassLoader() == null)
| {
| try
| {
| // Check the unit has a classloader
| unit.getClassLoader();
| // TODO clone the metadata?
| deployment.setClassLoader(new DeploymentClassLoaderMetaData(unit)); //
HERE
| }
| catch (Exception e)
| {
| log.debug("Unable to retrieve classloader for deployment: " +
unit.getName() + " reason=" + e.toString());
| }
| }
|
anonymous wrote :
| Rather than calling GBF directly from GBAF, if there is a pushed classloader I am
trying to wrap GBF in a wrapper class that implements the same createBean() method, but
with the option to specify the classloader. This gives me better results although I am
still seeing some failures.
The ClassLoaderMetaData is also used to decide the classloader for other things,
e.g. string conversion to classes so I don't think being able to specify a
classloader
on the GBF method is much help without rewriting all the metadata classes to also
allow the classloader to be overridden.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4193019#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...