Dynamically loading classes in WPS process

classic Classic list List threaded Threaded
2 messages Options
Lvw
Reply | Threaded
Open this post in threaded view
|

Dynamically loading classes in WPS process

Lvw
Hi list,

I want to dynamically load some interface implementing classes in my WPS process. I use the resourcefinder for that purpose, mentioned here:

http://stackoverflow.com/questions/7039467/java-serviceloader-with-multiple-classloaders.

I use it like this in a standalone java program:

    ResourceFinder finder = new ResourceFinder("META-INF/services/");
    Map plugins = finder.mapAvailableImplementations(JavaUnitTest.class);

    doSomethingWithThePlugins(plugins)...

And this looks for files in the META-INF/services directory relative from the classpath. However, when I deploy this code as a WPS process I do not know where to put my META-INF/services directory. I have copied to:

wps/META-INF/services
wps/WEB-INF/META-INF/services
wps/WEB-INF/lib/META-INF/services

But for none of them my classes are found.

Any ideas?
Lvw
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically loading classes in WPS process

Lvw
Found it: http://stackoverflow.com/questions/3420715/where-to-put-serviceloader-config-file-in-a-web-app

Put service descriptions here:

wps/WEB-INF/classes/META-INF/services