[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Deployers, Classloaders, and Reflection in JBoss 5

adrian@jboss.org do-not-reply at jboss.com
Thu Jun 4 09:39:23 EDT 2009


Help requests should really go in the user's forum:
http://www.jboss.org/index.html?module=bb&op=viewforum&f=228

My guess is that your problem lies with:
anonymous wrote : but I assume are brought into the deployers classloader

The deployer's classloader is a very different thing to the application classloader
which you can get from DeploymentUnit.getClassLoader(). 
The application classloader will change on every redeployment.

You should make sure you unhook anything that references the old 
classes or classloader in undeploy() so they can be garbage collected,
otherwise you'll leak classes and memory (which sounds like your real problem).

AFAIK, there's no deployer that uses the classloader directly. But we do have
deployers that pass the classloader into the component frameworks via their metadata,
which uses DeploymentUnit.getClassLoader().
e.g. http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/deployer/kernel/BeanMetaDataDeployer.java?revision=88706&view=markup

The closest we've got to what you are doing, uses our AnnotationScanning framework
to create metadata objects from annotated classes,
http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/deployer/kernel/BeanScanningDeployer.java?view=markup
they don't deal with the classloader explicitly.

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4235371#4235371

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4235371



More information about the jboss-dev-forums mailing list