Please find my questions/doubts at the end of the mail.

-----Original Message-----
From: Stephen McConnell [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 30, 2004 9:27 AM
To: 'Avalon framework users'; [EMAIL PROTECTED]
Subject: RE: Error while running embedded merlin




> -----Original Message-----
> From: Harvinder Singh [mailto:[EMAIL PROTECTED]
> Sent: 30 September 2004 01:28
> To: Avalon framework users
> Subject: Error while running embedded merlin
>
> Hi All,
>
> I am trying to use Merlin in embedded scenario.
> I am having many components and have generated all the xinfos for them
in
> one particular location. The corresponding class files are generated
in
> some other folder structure. In order to recognise these components, I

> specified the above location for xinfos in the classloader
> directive in block.xml (having the entries for all the components).
But
> when I run a test class having the embedded Merlin, it gives me the
> following  exception :
>
> org.apache.avalon.composition.model.TypeUnknownException:
> Unable to locate a component type descriptor for the component class
(xxx)
> in the classloader.
> Please verify that the component classname is correct and that a
component
> type descriptor is included
> in a jar file available within the container classloader.
>
> Going by the above statement, I zipped up all the xinfos in a jar file
and
> included it in the classpath
> in the classloader directive. Now it is able to find out the type
> descriptor
> but it starts giving me a different error:
>
> org.apache.avalon.composition.model.ModelException: Cannot load
component
> type because the type class XXX does not exist in the classloader.
>       at
>
org.apache.avalon.composition.model.impl.Scanner.getComponentClass(Scann
er
> .j
> ava:539)
>       at
>
org.apache.avalon.composition.model.impl.Scanner.addType(Scanner.java:35
3)
>       at
>
org.apache.avalon.composition.model.impl.Scanner.scanJarFile(Scanner.jav
a:
> 23
> 5)
>       at
>
org.apache.avalon.composition.model.impl.Scanner.scanJarFileURL(Scanner.
ja
> va
> :216)
>
> I also included the jar file(having the classes) in the classpath but
it
> still gives the same error.
> I just have a hunch whether the xinfo and the particular class files
> should be present in the same folder since in all the tutorials I
> referred, I noticed that the xinfos and class files are in the same
folder
> and put in the same jar file?
>
> Can someone give me a pointer to resolve this. I need it quite
urgently.

Classes and xinfo files are resolved relative to a classloader - as such
there is no problem with splitting up classes and xinfo files into
different directories - providing that the path for the class and the
xinfo is the same.  For example - a class reference to something like:

     org.apache.avalon.playground.MyComponent

Maps to the following:

      /org/apache/avalon/plyground/MyComponent.class
      /org/apache/avalon/plyground/MyComponent.xinfo

Providing the class and xinfo share the same address space - everything
should be ok.

Cheers, Steve.


Question : Does this mean then that "MyComponent" will get resolved only if
it has the same class name  as the xinfo file name.
Infact I tried with a sample component having the classname different from
the xinfo file name, and it did not get reolved and gave me an error. Issue
here is what suppose if I want to use the same implementation for two
different components.( my components have very similar functionality and
thus I wud like to use the same implementation passing a flag each time
which component to use.)
I will define both the components in block.xml having the same class names
and also an attribute 'type' which would suggest which one to use.
But the way merlin is behaving, it will need 2 different classes and two
different xinfos.
Will something like this work in Merlin :

MyComponent1.xinfo and MyComponent.class - resolves 1st component
MyComponent2.xinfo and MyComponent.class - resolves 2nd component

If not then please let me know how to achieve that?

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


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


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

Reply via email to