Thanks for the hint.
Simply calling 
javax.imageio.spi.IIORegistry.getDefaultInstance.registerApplicationClasspathSpis()
 Is not enough.

I will try some class loader magic from 
https://github.com/locationtech/geomesa/blob/geomesa-accumulo1.5-1.0.0-rc.7/geomesa-core/src/main/scala/org/locationtech/geomesa/core/iterators/TServerClassLoader.scala
 
<https://github.com/locationtech/geomesa/blob/geomesa-accumulo1.5-1.0.0-rc.7/geomesa-core/src/main/scala/org/locationtech/geomesa/core/iterators/TServerClassLoader.scala>

Regards,
Georg

 during application is not enough.
> Am 04.06.2017 um 22:24 schrieb Georg Heiler <e1225...@student.tuwien.ac.at>:
> 
> Thanks for the hints: 
> https://github.com/geoHeil/jai-packaging-problem/tree/master/files 
> <https://github.com/geoHeil/jai-packaging-problem/tree/master/files> shows 
> the contents of the jar and 
> https://github.com/geoHeil/jai-packaging-problem/blob/master/build.sbt#L82-L86
>  
> <https://github.com/geoHeil/jai-packaging-problem/blob/master/build.sbt#L82-L86>
>  shows that indeed the specific registries you mentioned are merged. 
> 
> I want to point out a plain standalone jar / java application works just fine 
> (even from the fat jar) only when run as a spark job or from NiFi I see the 
> problems. 
> 
> So far it looks like the Vectorize operation is not registered even though it 
> is here: 
> https://github.com/geoHeil/jai-packaging-problem/blob/master/files/registryFile.jai#L83-L89
>  
> <https://github.com/geoHeil/jai-packaging-problem/blob/master/files/registryFile.jai#L83-L89>
>  could it be that having 3 registry files (registry.jai, 
> registry.jaiExt,javax.media.jai.registryFile.ja 
> <https://github.com/geoHeil/jai-packaging-problem/blob/master/files/javax.media.jai.registryFile.jai>)
>  ? I tried to merge them manually into a single file but was not successful
> 
> Regards,
> Georg
> 
>> Am 04.06.2017 um 11:38 schrieb Georg Heiler <e1225...@student.tuwien.ac.at 
>> <mailto:e1225...@student.tuwien.ac.at>>:
>> 
>> Hi,
>> 
>> I want to use a library (JAI) with spark to parse some spatial raster files. 
>> Unfortunately, there are some strange issues. JAI only works when running 
>> via the build tool i.e. `sbt run` when executed in spark.
>> When executed via spark-submit the error is:
>> 
>>     java.lang.IllegalArgumentException: The input argument(s) may not be 
>> null.
>>      at 
>> javax.media.jai.ParameterBlockJAI.getDefaultMode(ParameterBlockJAI.java:136)
>>      at javax.media.jai.ParameterBlockJAI.<init>(ParameterBlockJAI.java:157)
>>      at javax.media.jai.ParameterBlockJAI.<init>(ParameterBlockJAI.java:178)
>>      at 
>> org.geotools.process.raster.PolygonExtractionProcess.execute(PolygonExtractionProcess.java:171)
>> 
>> Which looks like some native dependency is not there correctly.
>> Assuming something is wrong with the class path I tried to run a plain 
>> java/scala function. but this one works just fine.
>> Is spark messing with the class paths? Actually when trying to run the jar 
>> in NiFi, I see the same problem.
>> 
>> I created a minimal example here:
>> https://github.com/geoHeil/jai-packaging-problem 
>> <https://github.com/geoHeil/jai-packaging-problem>
>> 
>> Are you aware of any other library which can read ESRi ASCII Grid files and 
>> polygonize them?
>> 
>> I think so far the problem could be tracked down to the instantiation of     
>>  new ParameterBlockJAI("Vectorize") which is returning null i.e. the 
>> JAI.registry not finding the desired operation but returning a different 
>> error when the one you usually get.
>> 
>> Regards,
>> Georg
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to