Hi,
you could try to put the file in a source folder, so eclipse will output
it to the classpath.
Then you can build the registry like this:
ClassResolver resolver = new DefaultClassResolver();
RegistryBuilder builder = new RegistryBuilder();
builder.processModules( resolver );
URL moduleURL = resolver.getResource( "org/foo/hivemodule.xml" );
builder.processModule(resolver, new URLResource( moduleURL ) );
_registry = builder.constructRegistry(Locale.getDefault());
Of course you must change the script, that builds the jar.
Bye
Achim
Am Wed, 10 Mar 2004 01:37:55 -0500 schrieb Geoff Longman
<glongman@intelligentworks.com>:
> 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
|