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 <b...@transient.nz>
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 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(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.<init>(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
>> 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
>



-- 

Regards,

Andrea Aime

==
GeoServer Professional Services from the experts! Visit http://goo.gl/it488V
for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39  339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility  for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.
------------------------------------------------------------------------------
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

Reply via email to