Q: FactoryFinder does not work when running in Eclipse?
A: Yes.
You will need to run all your geotools related code in the same plugin; GeoTools uses FactorySPI to locate your DataStore plugin (or the any "factory"). The Factory SPI system makes use of a some files in your jars (in MANIFEST/services), the Eclipse Plugin System does not let you access anything that is in a non published package; and since MANIFEST/services is not a package ... we are really out of luck.
I have a couple of hopes:
- Perhaps by making use of OSGi bundles mechanisms (on which eclipse Plugin system is built) we can get around this?
- Martin has added some FactoryIterator things which we should be able to use to stuff additional factory instances into the mix; but I don't know how to do that yet
Here is the docs:
- http://docs.codehaus.org/display/GEOTDOC/02+Integration+Basics
- http://docs.codehaus.org/display/GEOTDOC/03+GeoTools+and+Eclipse+or+OSGi
For a working example look here:
Note the Eclipse docs say that the "BUDDY CLASSLOADER" system will solve these problems; in my experience it does not quite manage it. Yes you can find the jars; but FactorySPI still ends up broken.