Peter,

After trying (and failing) to get mailets loading from anything besides
james.bar, I read your message from Sept 30.  First, let me explain what I
want to do (in james), what I tried, and what happened:

Ideally james.sar could create an app/james/classes directory, that I would
probably populate with a sample mailet if necessary, and any class in this
classes directory would get loaded by the
org.apache.avalon.phoenix.components.classloader.PolicyClassLoader that
loads the bars in apps/james/blocks and jars in apps/james/lib.  Perhaps
this could get loaded by a classloader that has this PolicyClassLoader as a
parent so that the apps/james/classes classloader could be recycled so I
could reload mailet classes without needing to reload all the James classes.

If that's too ambitious for now, I would like to be able to add a jar to the
app/james/lib directory and have it load.  Unfortunately it seems the sar
remembers what jars it put in apps/james/lib, and if I put another jar in
there, avalon ignores it.

My last recourse was to put my jar in the core lib directory, which gets
loaded by sun.misc.Launcher$ExtClassLoader, because the run scripts now set
that lib folder as the ext folder.  Unfortunately mailets in there can't
access the mailet.jar, mail.jar, or activation.jar classes, so the server
just hangs (kind of weird... never throws any exception... I would if this
is a bug in the ExtClassLoader).

Mapping out a series of ClassLoaders might be useful, but as you mentioned,
I'm not sure how that would look in server.xml.  Do you need the extra
method to BlockContext to get the classloader since on object in that block
would return the same thing by calling getClass().getClassLoader(), or would
it return something different?

Serge Knystautas
Loki Technologies - Unstoppable Websites
http://www.lokitech.com/
----- Original Message -----
From: "Peter Donald" <[EMAIL PROTECTED]>
To: "Avalon Development" <avalon-dev@jakarta.apache.org>
Sent: Friday, October 26, 2001 7:09 AM
Subject: Re: Classloader thoughts?


> On Thu, 25 Oct 2001 05:35, Serge Knystautas wrote:
> > Again in JAMES... I've noticed some weird behavior I can't quite figure
out
> > (or figure out how to better figure out).  In a class that's loaded in
> > james.bar (in the apps/blocks directory that's extracted from
james.sar), I
> > call Class.forName(myClassName).newInstance().  However, it doesn't seem
to
> > want to load the class unless I have it in that james.bar file.  Is
there a
> > way I can load classes that are there OR in dist/apps/james/lib OR in
> > dist/lib?
>
> hmm - thats a bug - will look at it tomorrow.
>
> > Also, is there a way I can add a dist/classes directory (or
> > dist/apps/james/classes) and pull classes from there as well?
> >
> > (or point me towards where the classloader are for the bars/sars)
>
> The ClassLoader should be accessible from
>
> Thread.currentThread().getContextClassLoader()
>
> However we have also been talking about expanding ClassLoader
> support/management. I wouldn't mind hearing your opinion on a mail I wrote
on
> Sept 30 titled "[phoenix] RT: ClassLoader hierarchy".
>
> --
> Cheers,
>
> Pete
>
> ---------------------------------------------------
> "Wise men don't need advice. Fools don't take it."
>                         -Benjamin Franklin
> ---------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


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

Reply via email to