I have - yet again - a minimal deployment scenario (1 service interface, 1
implementing component) I am struggling with. If I do a

merlin -execute conf/component-manager.block

(see below for more info) I get

[INFO   ] (kernel): installing:
file:/${user.dir}/conf/component-manager.block
[INFO   ] (components.component-manager): Executing
[INFO   ] (components.component-manager): Finished executing ...
[INFO   ] (kernel): dissassembly phase
[INFO   ] (kernel): disposal phase

i.e. all goes smoothly. If, however, I deploy the block using a custom
testcase derived from AbstractMerlinTestCase with only

final public void testAcquisition() throws Exception
        {
                final DAOFactoryBuilder builder = (DAOFactoryBuilder) 
resolve(RES_PATH);

                assertNotNull(
                        "resolve(\"" + RES_PATH + "\") returned <null>.",
                        builder);
        }

added, I get an exception complaining that the xinfo file for the component
to be deployed could not be found - that is TypeBuilder fails to locate the
corresponding .xinfo file within deployment jar. Needless to say that it is
definitely there, as merlin cli well notices. I took great care to ensure
that melin cli as well as my testcase do deploy the exact same block
containing the exact same info. The merlin.deployment entry in
merlin.properties points to file:/${user.dir}/conf/component-manager.block,
the block merlin cli swallows without further ado. I manually copied the
generated jars to merlin cli's repository, opened them and verified that
they are exactly the same as those used by my testcase.

According to the source in TypeBuilder.buildFromXMLDescriptor() the problem
might be tracked back to classLoader.getResourceAsStream(classname.xinfo)
failing to load the existing xinfo file. But why should this happen?
classLoader is the classloader that loaded the class itself, it should also
load the .xinfo file in the same package. Or is it a classloader issue?

I wrote an embedded kernel that closely taking AbstractMerlinTestCase as a
blueprint, and it shows the exact same behaviour. Naturally, I would be glad
if anybody could explain to me what's going on here and how I might fix my
kernel.

Cheers,

Olaf

P.S.: One minor issue: the line

final String message =
                REZ.getString( "builder.missing-info.error", path );

in TypeBuilder.buildFromXMLDescriptor() should probably be changed to

final String message =
                REZ.getString( "builder.missing-info.error", classname );

Otherwise, as you will see below, the exception message is a little
misleading.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++

Debug + Stacktrace:

[DEBUG  ] (components.classloader.scanner): scanning: file:/C:/Dokumente und
Einstellungen/Otto
Berg/.maven/repository/manplan-merlin/jars/model-api-0.1.jar
[DEBUG  ] (components.classloader.scanner): scanning: file:/C:/Dokumente und
Einstellungen/Otto
Berg/.maven/repository/manplan-merlin/jars/model-spi-0.1.jar
[DEBUG  ] (components.classloader.scanner): scanning: file:/C:/Dokumente und
Einstellungen/Otto
Berg/.maven/repository/manplan-merlin/jars/model-impl-0.1.jar
[DEBUG  ] (components.classloader.scanner): scanning: file:/C:/Dokumente und
Einstellungen/Otto
Berg/.maven/repository/manplan-merlin/jars/persistence-api-0.1.jar
[DEBUG  ] (components.classloader.scanner): scanning: file:/C:/Dokumente und
Einstellungen/Otto
Berg/.maven/repository/manplan-merlin/jars/persistence-impl-0.1.jar
[DEBUG  ] (components.classloader.scanner): scanning: file:/C:/Dokumente und
Einstellungen/Otto
Berg/.maven/repository/manplan-merlin/jars/component-api-0.1.jar
[DEBUG  ] (components.classloader.scanner): scanning: file:/C:/Dokumente und
Einstellungen/Otto
Berg/.maven/repository/manplan-merlin/jars/component-impl-0.1.jar
---- exception
report ----------------------------------------------------------
Exception: org.apache.avalon.merlin.KernelException
Message: Install failure:
file:/C:/Projekte/OBergner/EclipseWorkspace/manplan-merlin/component/impl/co
nf/component-manager.block
----
cause ---------------------------------------------------------------------
Exception: org.apache.avalon.composition.model.ModelException
Message: Could not create classloader.
----
cause ---------------------------------------------------------------------
Exception: org.apache.avalon.composition.model.ModelException
Message: Unexpected error while scanning jar file: file:/C:/Dokumente und
Einstellungen/Otto
Berg/.maven/repository/manplan-merlin/jars/component-impl-0.1.jar
----
cause ---------------------------------------------------------------------
Exception: java.lang.Exception
Message: Unable to locate resource from which to load info for component
implemented by class
"manplan/merlin/component/impl/persistence/DefaultDAOFactoryBuilder.xinfo".
---- stack
trace ---------------------------------------------------------------
java.lang.Exception: Unable to locate resource from which to load info for
component implemented by class
"manplan/merlin/component/impl/persistence/DefaultDAOFactoryBuilder.xinfo".
org.apache.avalon.meta.info.builder.TypeBuilder.buildFromXMLDescriptor(TypeB
uilder.java:186)
org.apache.avalon.meta.info.builder.TypeBuilder.buildType(TypeBuilder.java:1
04)
org.apache.avalon.composition.model.impl.Scanner.addType(Scanner.java:377)
org.apache.avalon.composition.model.impl.Scanner.scanJarFile(Scanner.java:25
8)
org.apache.avalon.composition.model.impl.Scanner.scanJarFileURL(Scanner.java
:239)
org.apache.avalon.composition.model.impl.Scanner.scanURL(Scanner.java:197)
org.apache.avalon.composition.model.impl.Scanner.scan(Scanner.java:170)
org.apache.avalon.composition.model.impl.DefaultClassLoaderModel.<init>(Defa
ultClassLoaderModel.java:235)
org.apache.avalon.composition.model.impl.DefaultClassLoaderModel.createClass
LoaderModel(DefaultClassLoaderModel.java:129)
org.apache.avalon.composition.model.impl.DefaultContainmentModel.createConta
inmentModel(DefaultContainmentModel.java:464)
org.apache.avalon.composition.model.impl.DefaultContainmentModel.createConta
inmentModel(DefaultContainmentModel.java:427)
org.apache.avalon.composition.model.impl.DefaultContainmentModel.createConta
inmentModel(DefaultContainmentModel.java:663)
org.apache.avalon.composition.model.impl.DefaultContainmentModel.addContainm
entModel(DefaultContainmentModel.java:288)
org.apache.avalon.composition.model.impl.DefaultContainmentModel.addModel(De
faultContainmentModel.java:282)
org.apache.avalon.merlin.impl.DefaultFactory.create(DefaultFactory.java:488)
org.apache.avalon.merlin.unit.AbstractMerlinTestCase.setUp(AbstractMerlinTes
tCase.java:198)
junit.framework.TestCase.runBare(TestCase.java:125)
junit.framework.TestResult$1.protect(TestResult.java:106)
junit.framework.TestResult.runProtected(TestResult.java:124)
junit.framework.TestResult.run(TestResult.java:109)
junit.framework.TestCase.run(TestCase.java:118)
junit.framework.TestSuite.runTest(TestSuite.java:208)
junit.framework.TestSuite.run(TestSuite.java:203)
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
nner.java:392)
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
java:276)
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
.java:167)
----------------------------------------------------------------------------
----

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++

component-manager.block:

<container name="components">

   <services>
     <service type="manplan.merlin.component.api.ComponentManager">
       <source>component-manager</source>
     </service>
   </services>

   <classloader>
     <classpath>
       <repository>
         <resource id="manplan-merlin:model-api" version="0.1"/>
         <resource id="manplan-merlin:model-spi" version="0.1"/>
         <resource id="manplan-merlin:model-impl" version="0.1"/>
         <resource id="manplan-merlin:persistence-api" version="0.1"/>
         <resource id="manplan-merlin:persistence-impl" version="0.1"/>
         <resource id="manplan-merlin:component-api" version="0.1"/>
         <resource id="manplan-merlin:component-impl" version="0.1"/>
         <resource id="log4j:log4j" version="1.2.8"/>
         <resource id="hibernate:hibernate" version="2.1.1"/>
         <resource id="commons-collections:commons-collections"
version="3.0-dev2"/>
         <resource id="dom4j:dom4j" version="1.4"/>
       </repository>
     </classpath>
   </classloader>

   <component name="component-manager"
       class="manplan.merlin.component.impl.DefaultComponentManager"
activation="startup">
   </component>

</container>

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++

manplan/merlin/component/impl/DefaultComponentManager.xinfo (for what it's
worth):

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE type PUBLIC "-//AVALON/Type DTD Version 1.0//EN"
"http://avalon.apache.org/dtds/meta/type_1_1.dtd"; >

<type>
  <info>
    <name>component-manager</name>
    <version>0.1.0</version>
    <lifestyle>singleton</lifestyle>
  </info>
  <services>
    <service type="manplan.merlin.component.api.ComponentManager"/>
  </services>
</type>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to