Reputation: 10232
I am trying to load and parse a shapefile using the GeoTools library. However, when I try to load the file the following call is resulting is a dependency failure for org.geotools.factory.FactoryRegistry
:
DataStore newStore = DataStoreFinder.getDataStore(connect);
Error:
org/geotools/factory/FactoryRegistry
java.lang.NoClassDefFoundError: org/geotools/factory/FactoryRegistry
I have included the following dependencies in gradle:
compile files ('libs/geotools/gt-opengis-14.2.jar')
compile files ('libs/geotools/gt-api-14.2.jar')
compile files ('libs/geotools/gt-shapefile-14.2.jar')
compile files ('libs/geotools/gt-cql-14.2.jar')
compile files ('libs/geotools/gt-main-14.2.jar')
compile files ('libs/geotools/gt-referencing-14.2.jar')
compile files ('libs/geotools/gt-epsg-hsql-14.2.jar')
I am not sure if all of them are needed but none of them have the missing class. Is there any other dependency I am missing? The class is documented here.
Upvotes: 2
Views: 1994
Reputation: 10976
The easy answer to this problem is to use Maven to manage your dependencies, this would then automatically pull in gt-metadata
for you and solve your problem.
If you must manage your dependencies by hand then the I wrote a blog post that describes how to use oops to search the GeoTools jars for a class.
Upvotes: 1