Re: [Geotools-gt2-users] Geotools Error on SBT Assembly

2018-04-16 Thread Ken
Thank you for the succint replies! SBT assembly does exclude files inside
the META-INF directory (https://github.com/sbt/sbt-assembly/issues/11). I
know what to do now, thanks again!

Ken Abryl Eleazar Salanio
kssala...@gmail.com

On Sun, Apr 15, 2018 at 9:37 PM, Andrea Aime 
wrote:

> Yep,
> as Ben said.
> See also this FAQ entry, does not talk about SBT, but what the Maven shade
> plugin does in this description, you'll have to replicate with SBT:
>
> http://docs.geotools.org/latest/userguide/build/faq.
> html#how-do-i-create-an-executable-jar-for-my-geotools-app
>
> Cheers
> Andrea
>
> On Sun, Apr 15, 2018 at 2:32 PM, Ben Caradoc-Davies 
> wrote:
>
>> 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 Lengthat
>>> 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(FilterFactory
>>> Impl.java:754)
>>> at
>>> org.geotools.feature.AttributeTypeBuilder.lengthRestriction(
>>> AttributeTypeBuilder.java:615)
>>> at
>>> org.geotools.feature.AttributeTypeBuilder.buildType(Attribut
>>> eTypeBuilder.java:446)
>>> at
>>> org.geotools.feature.AttributeTypeBuilder.buildDescriptor(At
>>> tributeTypeBuilder.java:507)
>>> at
>>> org.geotools.data.shapefile.ShapefileFeatureSource.readAttri
>>> butes(ShapefileFeatureSource.java:567)
>>> at
>>> org.geotools.data.shapefile.ShapefileFeatureSource.buildFeat
>>> ureType(ShapefileFeatureSource.java:475)
>>> at
>>> org.geotools.data.shapefile.ShapefileFeatureStore.buildFeatu
>>> reType(ShapefileFeatureStore.java:134)
>>> at
>>> org.geotools.data.store.ContentFeatureSource.getAbsoluteSche
>>> ma(ContentFeatureSource.java:356)
>>> at
>>> org.geotools.data.store.ContentFeatureSource.getSchema(Conte
>>> ntFeatureSource.java:325)
>>> at
>>> org.geotools.data.store.ContentFeatureCollection.(Cont
>>> entFeatureCollection.java:80)
>>> at
>>> org.geotools.data.store.ContentFeatureSource.getFeatures(Con
>>> tentFeatureSource.java:583)
>>> at
>>> thesis.ShapeFileReader$.readSimpleFeatures(ShapeFileReader.scala:41)
>>> at
>>> thesis.ShapeFileReader$.readMultiPolygonFeatures(ShapeFileRe
>>> ader.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(Ma
>>> in.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(NativeMethodAcce
>>> ssorImpl.java:62)
>>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
>>> thodAccessorImpl.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
>>> 

Re: [Geotools-gt2-users] Geotools Error on SBT Assembly

2018-04-15 Thread Andrea Aime
Yep,
as Ben said.
See also this FAQ entry, does not talk about SBT, but what the Maven shade
plugin does in this description, you'll have to replicate with SBT:

http://docs.geotools.org/latest/userguide/build/faq.html#how-do-i-create-an-executable-jar-for-my-geotools-app

Cheers
Andrea

On Sun, Apr 15, 2018 at 2:32 PM, Ben Caradoc-Davies 
wrote:

> 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 Lengthat
>> 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(FilterFactory
>> Impl.java:754)
>> at
>> org.geotools.feature.AttributeTypeBuilder.lengthRestriction(
>> AttributeTypeBuilder.java:615)
>> at
>> org.geotools.feature.AttributeTypeBuilder.buildType(Attribut
>> eTypeBuilder.java:446)
>> at
>> org.geotools.feature.AttributeTypeBuilder.buildDescriptor(At
>> tributeTypeBuilder.java:507)
>> at
>> org.geotools.data.shapefile.ShapefileFeatureSource.readAttri
>> butes(ShapefileFeatureSource.java:567)
>> at
>> org.geotools.data.shapefile.ShapefileFeatureSource.buildFeat
>> ureType(ShapefileFeatureSource.java:475)
>> at
>> org.geotools.data.shapefile.ShapefileFeatureStore.buildFeatu
>> reType(ShapefileFeatureStore.java:134)
>> at
>> org.geotools.data.store.ContentFeatureSource.getAbsoluteSche
>> ma(ContentFeatureSource.java:356)
>> at
>> org.geotools.data.store.ContentFeatureSource.getSchema(Conte
>> ntFeatureSource.java:325)
>> at
>> org.geotools.data.store.ContentFeatureCollection.(Cont
>> entFeatureCollection.java:80)
>> at
>> org.geotools.data.store.ContentFeatureSource.getFeatures(Con
>> tentFeatureSource.java:583)
>> at
>> thesis.ShapeFileReader$.readSimpleFeatures(ShapeFileReader.scala:41)
>> at
>> thesis.ShapeFileReader$.readMultiPolygonFeatures(ShapeFileRe
>> ader.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(NativeMethodAcce
>> ssorImpl.java:62)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
>> thodAccessorImpl.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
>> 

Re: [Geotools-gt2-users] Geotools Error on SBT Assembly

2018-04-15 Thread Ben Caradoc-Davies

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 Lengthat
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.(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 
Director
Transient Software Limited 
New Zealand

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, 

[Geotools-gt2-users] Geotools Error on SBT Assembly

2018-04-14 Thread Ken
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 Lengthat
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.(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