[Design of POJO Server] - Re: Classloader problem with NamingRestartUnitTestCase
by adrian@jboss.org
My guess is that AOP is caching the classloader somewhere?
The most obvious candidate is this code in AOPDependencyBuilder:
| AspectManager manager = AspectManagerFactory.getAspectManager(metaData);
|
which eventually boils down to a lookup by a String based on the deployment name
AspectManagerFactory
| public static AspectManager getAspectManager(MetaData md)
| {
| AspectManager manager = AspectManager.instance();
| if (md != null)
| {
| ApplicationScope app = md.getMetaData(ApplicationScope.class);
| DeploymentScope dep = md.getMetaData(DeploymentScope.class);
| if (app != null && dep != null)
| {
| JBossStringBuilder fqn = new JBossStringBuilder("/");
| AspectManager sub = null;
| if (app != null)
| {
| String name="APPLICATION=" + app.value();
| fqn.append(name);
| fqn.append("/");
| sub = manager.findManagerByName(fqn.toString());
| if (sub == null)
| {
| sub = createNewDomain(manager, name);
| }
| }
|
| if (dep != null)
| {
| String name="DEPLOYMENT=" + dep.value();
| fqn.append(name);
| fqn.append("/");
| AspectManager parent = sub;
| sub = manager.findManagerByName(fqn.toString());
| if (sub == null)
| {
| sub = createNewDomain(parent, name);
| }
| }
| return sub;
| }
| }
| return manager;
| }
|
AspectManager:
| /** A map of domains by name */
| protected volatile WeakValueHashMap subDomainsByName = UnmodifiableEmptyCollections.EMPTY_WEAK_VALUE_HASHMAP;
|
Although this is a WeakValueHashMap, there's no guarantee that
it will be reaped (depends when the GC runs) between redeployments
and there is no "remove" at undeployment.
So if something in the sub Domain created for the deployment name
references the old classloader, it is going to leak across redeployment.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4126649#4126649
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4126649
18 years, 2 months
[Design of POJO Server] - Re: EJB/War deployer ordering problem
by adrian@jboss.org
"alesj" wrote : "scott.stark(a)jboss.org" wrote : I don't think we should have to do that? The deployment context state should not reach DeploymentState.DEPLOYED unless all its components are installed, right?
| |
| Hmm, I don't think we currently introduce any dependencies between deployment context and its components.
| I'll have a look, but I don't remember seeing any dependency items being put on DeploymentControllerContext.
|
If any sub deployment "fails" then the whole deployment (top level
and subdeployments) is unravelled.
But that is different from a dependency being missing.
That is just something that can be satisifed by deploying the missing dependency.
It the ServiceMetaData that represents the war that should have the depends
not the deployment context.
You're going to get into all sorts of cirucular reference problems if you want
the war to add dependencies to the deployment context that is a reference
to an ejb in the same ear.
The DeploymentControllerContext is per top level deployment,
you can't move individual subdeployments to different deployment stages,
the whole thing moves together (including uninstalling to the ERROR stage
if one of the subdeployments produces an error).
e.g. war -> depends -> ejb1
my.ear -> myejbs.jar -> ejb1
my.ear -> my.war -> servlet1 -> ejb-ref -> ejb1
There is only one DeploymentControllerContext for my.ear
so making my.ear depend on ejb1 is a cirucular reference that will
never be satisied.
i.e. my.ear won't reach the REAL stage until ejb1 is installed
ejb1 won't be installed because my.ear never reaches the REAL stage
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4126598#4126598
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4126598
18 years, 2 months