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:43:50 GMT


> I don't know why you get this exceptions, but why don't you just put your
> module-descriptor in src/META-INF/hivemodule.xml. And than call
> Registry reg = RegistryBuilder.constructDefaultRegistry(). This will take
> all the META-INF/hivemodule.xml which are on the classpath - wheter jared
> or not.

Yes, I could do that. I was just trying to do it the "Howard" way.

>
> Apart of this my JUnit tests generally extend from
> org.apache.hivemind.test.HiveMindTestCase. It has a number of convienience
> methods one of which is buildFrameworkRegistry(), which also loads like
> above the hivemodules in META-INF, but for which you can additional
> specify module-descriptors which are located anywhere in the class-path.

Neat! And also the "Howard" way.

>
> Hopefully this helps a bit.
>
> Chris
>
>
> On Wed, 10 Mar 2004 01:37:55 -0500, Geoff Longman
> <glongman@intelligentworks.com> 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
>
>
>
> --
> Christian Essl
>
> ---------------------------------------------------------------------
> 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