Ken,
does your fat jar include all the module META-INF/services SPI files
from the module jars? (And concatenate those with the same name?)
GeoTools loads many SPI providers, including those for functions and
data stores. If some of these entries are omitted from the fat jar,
those SPI providers will not be found. In particular, the gt-main copy
of META-INF/services/org.opengis.filter.expression.Function will be
needed in the fat jar for org.geotools.filter.LengthFunction to be
available via SPI and found by the filter factory. As can be seen from
the stack trace below, this function is used to set length restrictions
when reading shapefiles.
Kind regards,
Ben.
On 15/04/18 15:58, Ken wrote:
Hi, I'm trying to use the following:
- gt-shapefile v19.0
- SBT 1.0.3
- SBT Assembly v0.14.5
- Scala v2.11.12
If I compile and run via SBT, everything works fine. However if I assemble
a fat jar, this error pops out:
*Exception in thread "main" java.lang.RuntimeException: Unable to find
function Length at
org.geotools.filter.FunctionFinder.findFunction(FunctionFinder.java:205)
at
org.geotools.filter.FunctionFinder.findFunction(FunctionFinder.java:152)
at
org.geotools.filter.FunctionFinder.findFunction(FunctionFinder.java:127)
at
org.geotools.filter.FilterFactoryImpl.function(FilterFactoryImpl.java:754)
at
org.geotools.feature.AttributeTypeBuilder.lengthRestriction(AttributeTypeBuilder.java:615)
at
org.geotools.feature.AttributeTypeBuilder.buildType(AttributeTypeBuilder.java:446)
at
org.geotools.feature.AttributeTypeBuilder.buildDescriptor(AttributeTypeBuilder.java:507)
at
org.geotools.data.shapefile.ShapefileFeatureSource.readAttributes(ShapefileFeatureSource.java:567)
at
org.geotools.data.shapefile.ShapefileFeatureSource.buildFeatureType(ShapefileFeatureSource.java:475)
at
org.geotools.data.shapefile.ShapefileFeatureStore.buildFeatureType(ShapefileFeatureStore.java:134)
at
org.geotools.data.store.ContentFeatureSource.getAbsoluteSchema(ContentFeatureSource.java:356)
at
org.geotools.data.store.ContentFeatureSource.getSchema(ContentFeatureSource.java:325)
at
org.geotools.data.store.ContentFeatureCollection.<init>(ContentFeatureCollection.java:80)
at
org.geotools.data.store.ContentFeatureSource.getFeatures(ContentFeatureSource.java:583)
at
thesis.ShapeFileReader$.readSimpleFeatures(ShapeFileReader.scala:41)
at
thesis.ShapeFileReader$.readMultiPolygonFeatures(ShapeFileReader.scala:94)
at thesis.Refactored$.maskRaster(Refactored.scala:122) at
thesis.Main$$anonfun$run$1$$anonfun$apply$1$$anonfun$2.apply(Main.scala:191)
at
thesis.Main$$anonfun$run$1$$anonfun$apply$1$$anonfun$2.apply(Main.scala:191)
at thesis.Refactored$.time(Refactored.scala:48) at
thesis.Main$$anonfun$run$1$$anonfun$apply$1.apply$mcVI$sp(Main.scala:190)
at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:160)
at thesis.Main$$anonfun$run$1.apply(Main.scala:181) at
thesis.Main$$anonfun$run$1.apply(Main.scala:172) at
scala.collection.immutable.List.foreach(List.scala:381) at
thesis.Main$.run(Main.scala:172) at
thesis.Main$.main(Main.scala:125) at thesis.Main.main(Main.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498) at
org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:755)
at
org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:180)
at
org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:205)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:119)
at
org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)18/04/15
11:42:37 INFO util.ShutdownHookManager: Shutdown hook called*All the fixes
i've searched and tried seem to be outdated and don't work for me. Is there
anything I can do about this error?
Ken Abryl Eleazar Salanio
kssala...@gmail.com
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
--
Ben Caradoc-Davies <b...@transient.nz>
Director
Transient Software Limited <https://transient.nz/>
New Zealand
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users