sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Desruisseaux (Jira)" <>
Subject [jira] [Commented] (SIS-499) CommonCRS.WGS84.geographic() fails to initialize with JDK 11.0.8
Date Mon, 17 Aug 2020 12:10:00 GMT


Martin Desruisseaux commented on SIS-499:

I'm not familar with the Eclipse platform. But if the later error is related to the _"XXX
is not an ImageIO SPI class"_ error, then it is normal. There is two classes that can be used
for loading services in Java:
 * {{java.util.ServiceLoader}}
 * {{javax.imageio.spi.IIOServiceProvider}}

The former is the general-purpose class that everyone should use. The second is, in theory,
reserved to the Image I/O package. However because that second class provides more functionality
than the former, it was tempting to use it even for non-imaging services. Indeed, Apache SIS
did that in older versions (years ago), and some other libraries did that too. But when Jigsaw
arrived, it had major impact on the way modules declare services. The {{java.util.ServiceLoader}}
class has been updated accordingly. I don't know if the {{IIOServiceProvider}} class has been
updated too, but anyway Oracle decided that starting with JDK 9 everyone should use {{java.util.ServiceLoader}}.
Consequently theĀ _"XXX is not an ImageIO SPI class"_ error message has been added in JDK
9 for blocking any attempt to use {{IIOServiceProvider}} for non-imaging services.

The fix is to replace all use of {{IIOServiceProvider}} by {{java.util.ServiceLoader}}. It
seems to me that we have done that in SIS a few years ago. So if this error is still happening,
 * Either we forgot to do the replacement somewhere in SIS.
 * Either the error happens in another library which is still using {{javax.imageio.spi.IIOServiceProvider}}.

The stack trace should answer the question of which library is still using {{IIOServiceProvider}}.

> CommonCRS.WGS84.geographic() fails to initialize with JDK 11.0.8
> ----------------------------------------------------------------
>                 Key: SIS-499
>                 URL:
>             Project: Spatial Information Systems
>          Issue Type: Bug
>          Components: Build process
>    Affects Versions: 1.0
>            Reporter: Roland
>            Assignee: Martin Desruisseaux
>            Priority: Major
>         Attachments:, pom.Failure.xml
> We have in the constructor of a class the following code:
> {{CoordinateReferenceSystem targetCRS = CommonCRS.WGS84.geographic();}}
> When we run the Maven build with Java 1.8.0_252 the build succeeds. Running with OpenJDK
11.0.8 it fails with
> java.util.ServiceConfigurationError: org.opengis.referencing.datum.DatumFactory: org.apache.sis.referencing.factory.GeodeticObjectFactory
Unable to get public no-arg constructor
>  at java.base/
>  at java.base/java.util.ServiceLoader.getConstructor(
>  at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(
>  at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(
>  at java.base/java.util.ServiceLoader$2.hasNext(
>  at java.base/java.util.ServiceLoader$3.hasNext(
>  at org.apache.sis.internal.system.DefaultFactories.forClass(
>  at org.apache.sis.internal.system.DefaultFactories.forBuildin(
>  at org.apache.sis.referencing.factory.sql.EPSGFactory.factory(
>  at org.apache.sis.referencing.factory.sql.EPSGFactory.<init>(
>  at org.apache.sis.referencing.AuthorityFactories.EPSG(
>  at org.apache.sis.referencing.CommonCRS.factory(
>  at org.apache.sis.referencing.CommonCRS.geographic(
>  at at.weberhofer.webcommons_geo.converter.PointConverter.<init>(

This message was sent by Atlassian Jira

View raw message