341008
341008

Reputation: 10232

Not able to locate FactoryRegistry class when using GeoTools

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

Answers (1)

Ian Turton
Ian Turton

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

Related Questions