RE: Problem in Block composition
"Stephen McConnell" <[email protected]> Fri, 29 Oct 2004 12:12:01 +0200
| Newsgroups | gmane.comp.jakarta.avalon.user |
|---|---|
| Message-ID | <000301c4bd9f$bb8aebf0$1601a8c0@gloria> |
> -----Original Message----- > From: Harvinder Singh [mailto:[email protected]] > Sent: 28 October 2004 18:49 > To: Avalon framework users > Subject: Problem in Block composition > > Hi All, > > I am facing a problem regarding block composition. > I have 3 blocks, an empty block.xml, BlockA.xml and BlockB.xml having the > entries of some components. > I am embedding Merlin and instantiating the kernel with an empty > block.xml, > which just has the following entry: > > <container name="XXX"> > </container> Just for reference - a container declaration in the kernel is the root container and if you don't include any container definition you will get the same as what you are declaring above by default. > Once my kerlnel gets initialized properly, I then add a containment model > like : > > URL blockUrl = new URL("location of BlockA.xml"); > ContainmentModel ContainerA = > ((ContainmentModel)m_root).addContainmentModel(blockUrl); > ContainerA.commission(); > > blockUrl = new URL("location of BlockB.xml"); > ContainmentModel ContainerB = > ((ContainmentModel)m_root).addContainmentModel(blockUrl); > ContainerB.commission(); > > Now my containerA gets commissioned properly but containerB does not get > commisioned since it is having some components which are dependent upon > components present in containerA. It gives me an error : > Unable to assemble component: [/ServiceContainer/ComponentX] due to a > service provider establishment failure. What you should be doing is add BlockA, then add Block B, then commission the root container. Cheers, Steve.