avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vincent Tencé <Vincent.TE...@gemplus.com>
Subject ExclaliburComponentManager
Date Tue, 12 Feb 2002 23:02:40 GMT
Hi everybody,

I'm new to the world of Avalon and have some questions regarding
ExcaliburComponentManager.
But first a quick introduction.

We are currently developping web server applications that we run in Tomcat
(the version I used
at the moment is 3.2.3, I might jump to 4.x soon). I have been looking to
the Avalon framework
for about a month and I introduced it to my team of developers.

So far I am very happy with the results! It's a way to enforce usage of best
practises and patterns
in our work and we can leverage the work that has been put into Avalon. Thx
for that.
We are learning a lot from the code we use and we can feel the benefits of
using patterns like IoC and SoC.

Now the problem :-) and the question. Somehow with Tomcat (maybe only 3.2.3)
the context class loader
cannot find my classes so we have to use getClass().getClassLoader(). It's
an issue since in a lot
of the excalibur code the context class loader is used by default.

I guess there are workarounds, and we had to think of one for
ExcaliburComponentSelector. We want
to use a selector in our roles.xml file but ExcaliburComponentSelector
cannot find any classes of the
webapp.
So we overrided ExcaliburComponentManager like this (not very clean) and
used that class instead:

public class DefaultComponentSelector extends ExcaliburComponentSelector {

    private static Class clazz;

    static {
        clazz = new HackClass().getClass();
    }

    public DefaultComponentSelector() {
        super(clazz.getClassLoader());
    }

    private static class HackClass {
    }
}

I wanted to know I you have also experienced that problem when using Avalon
with servlet containers.
Is it a tomcat issue? I am not very familiar with class loader issues. Is
there a better way
to get the same result than the hack code above? What is the preferred way
of doing things here?

Btw, I guess there is mistake in the paper Developping with Apache Avalon at
bottom of page 39 (pdf format).
There is an example of an xml configuration file and it says that when you
have multiple instances
of a component you specify the instance name with the "hint" keyword but the
code is expecting "name" instead.

Thanks for your answers,
Vincent

Hope everybody will understand my English :)



--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message