commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geoff Longman" <glong...@intelligentworks.com>
Subject Re: [Hivemind] Question about customized ClassResolvers
Date Wed, 10 Mar 2004 14:40:35 GMT
I'll give your classloader a try at some point. For now, the hard coded
classpath in the Eclipse launch config works fine.

BTW - The paths that are passed as URLs to URLClassloader:

My Code:
file:/X:/eclipse/e21/workspace/hivemind-session-local

TestRegistryBuilder:
file:/X:/eclipse/e21/workspace/hivemind/src/test-data/TestRegistryBuilder

Funny, now TestRegistryBuilder fails with the same error. I think I stayed
up too late!

Geoff


----- Original Message -----
From: "John Rubier" <insurgent@insurgent.us>
To: "Jakarta Commons Developers List" <commons-dev@jakarta.apache.org>
Sent: Wednesday, March 10, 2004 4:34 AM
Subject: Re: [Hivemind] Question about customized ClassResolvers


> Hey Geoff,
> It may have something to do with HiveMind passing the path (hard coded)
"META-INF/hivemodule.xml". I think depending on how your project is set up
and/or what classloaders are involved, it may want /META-INF or who knows.
Just a guess.
> You might give that multimodule classloader I posted a few days back a try
as you can specify paths to the hivemodule.xml files in a properties file.
Now whether it will pick up the props file itself is a different story :)
> I also haven't tried it under jetty/whatever...YMMV
>
> Take care,
>
> John
>
> On Wednesday March 10th 2004, Geoff Longman wrote:
>
> > Hey, I have tweaked up my own version of HiveMindFilter's init() method
> > because I want to run a junit test in Eclipse and have the Registry pick
up
> > my as yet notjarred hivemodule.xml
> > Having looked at TestRegistryBuilder, it appears that this should work:
> > // want to pick up META-INF/hivemodule.xml in the project root
> > File f = new File("");
> > URL[] urls = new URL[] { f.toURL()};
> > ClassLoader loader =
> > new URLClassLoader(urls,
> > Thread.currentThread().getContextClassLoader());
> > ClassResolver resolver = new DefaultClassResolver(loader);
> > // end of Tweak
> > RegistryBuilder builder = new RegistryBuilder();
> > builder.processModules(resolver);
> > _registry = builder.constructRegistry(getRegistryLocale());
> > When checking the URL from the File in the debugger it looks right, i.e.
the
> > URL refers to the root of my project.
> > But, I get the following error:
> > org.apache.hivemind.ApplicationRuntimeException: Registry does not
contain
> > module 'com.iw.session.local'.
> > ^^^ the name of the module I have constructed.
> > Even stranger, if I leave the code above as is and force the Eclipse
junit
> > test launch config classpath to contain the project root folder,
everything
> > works - green lights across the board..
> > I'm not really that up on these classloader tricks. Does anyone see
> > something here?
> > Geoff
> > Geoffrey Longman
> > Intelligent Works Inc.
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message