[jboss-jira] [JBoss JIRA] Created: (JBMICROCONT-159) Multiple components
Scott M Stark (JIRA)
jira-events at lists.jboss.org
Sun Mar 18 22:20:34 EDT 2007
Multiple components
--------------------
Key: JBMICROCONT-159
URL: http://jira.jboss.com/jira/browse/JBMICROCONT-159
Project: JBoss MicroContainer
Issue Type: Bug
Components: Deployment
Affects Versions: JBossMC_2_0_0 Beta3
Reporter: Scott M Stark
There is a problem with how component deployments are handled. When a DeploymentUnit contains multiple sources of component metadata (a jar with a META-INF/*-beans.xml,*-service.xml for example), duplicate processing of components is occuring. This is due to the AbstractComponentDeployer.deployComponents query for the component metadata:
protected void deployComponents(DeploymentUnit unit) throws DeploymentException
{
if (compVisitor == null)
return;
Set<? extends C> components = unit.getAllMetaData(componentType);
for (C component : components)
compVisitor.deploy(unit, component);
}
The DeploymentUnit.getAllMetaData(componentType) for the current DeploymentComponentContext looks to its parent for metadata. This combined with the recursive processing in the MainDeployerImpl.commitDeploy:
private void commitDeploy(Deployer deployer, DeploymentContext context, Set<DeploymentContext> components)
throws DeploymentException
{
DeploymentContext[] theComponents = null;
if (components != null && components.isEmpty() == false)
theComponents = components.toArray(new DeploymentContext[components.size()]);
DeploymentUnit unit = context.getDeploymentUnit();
deployer.commitDeploy(unit);
try
{
if (theComponents != null)
{
for (int i = 0; i < theComponents.length; ++i)
{
try
{
Set<DeploymentContext> componentComponents = theComponents[i].getComponents();
commitDeploy(deployer, theComponents[i], componentComponents);
}
catch (DeploymentException e)
{
// Unwind the previous components
for (int j = i-1; j >=0; --j)
prepareUndeploy(deployer, theComponents[j], true);
throw e;
}
}
}
}
catch (DeploymentException e)
{
prepareUndeploy(deployer, context, false);
throw e;
}
}
Results in a structure like:
DU(some.jar)
+ CDC(Bean1)
+ CDC(ServiceBean2)
+ CDC(Bean2)
+ CDC(ServiceBean2)
+ CDC(ServiceBean1)
+ CDC(ServiceBean2)
+ CDC(ServiceBean2)
The service deployer components are being recursively added to the kernel components and duplicate install errors result.
See the org.jboss.test.deployers.deployer.test.MultipleComponentTypeUnitTestCase
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list