Vincent Tenc� wrote:
<snip/>
> 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.
Glad to hear it.
>
> 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.
This has to do with actually setting the ContextClassloader. Cocoon handles this
in the Servlet's service() method by explicitly calling
Thread.currentThread().setContextClassLoader(this.classloader);
with every request (handles new threads that are introduced.
> 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 {
> }
> }
You can also do this:
super(this.getClass().getClassLoader());
That works as well.
> 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 :)
Hopefully my answers helped you :)
--
"They that give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety."
- Benjamin Franklin
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>