geowave icon indicating copy to clipboard operation
geowave copied to clipboard

Use of incorrect ServiceLoader causes runtime failures

Open michaeljfazio opened this issue 5 years ago • 0 comments

During initialisation of a Spark application, the following exception is thrown:

Caused by: java.lang.IllegalArgumentException: org.locationtech.geowave.core.store.data.field.FieldSerializationProviderSpi is not an ImageIO SPI class
        at java.desktop/javax.imageio.spi.ServiceRegistry.checkClassAllowed(ServiceRegistry.java:722)
        at java.desktop/javax.imageio.spi.ServiceRegistry.<init>(ServiceRegistry.java:117)
        at org.locationtech.geowave.core.index.SPIServiceRegistry.<init>(SPIServiceRegistry.java:42)
        at org.locationtech.geowave.core.store.data.field.FieldUtils.initRegistry(FieldUtils.java:47)
        at org.locationtech.geowave.core.store.data.field.FieldUtils.getRegisteredFieldReaders(FieldUtils.java:32)
        at org.locationtech.geowave.core.store.data.field.FieldUtils.getDefaultReaderForClass(FieldUtils.java:81)
        at org.locationtech.geowave.core.store.query.options.CommonQueryOptions$HintKey.init(CommonQueryOptions.java:42)
        at org.locationtech.geowave.core.store.query.options.CommonQueryOptions$HintKey.<init>(CommonQueryOptions.java:38)
        at org.locationtech.geowave.core.store.util.DataStoreUtils.<clinit>(DataStoreUtils.java:99)

The issue manifests itself because of changes made in the JDK version 9 and above that explicitly forbid use of the ImageIO service loader for loading non ImageIO SPI classes. The class org.locationtech.geowave.core.index.SPIServiceRegistry.java directly extends the ImageIO service loader. It should java.util.ServiceLoader

See:

https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8068749

Using JDK version 8 and below are a workaround, although not a practical one in our current environment.

michaeljfazio avatar May 04 '20 05:05 michaeljfazio