When I try to add a GeoTIFF as a store on GeoServer, GeoServer fails to add the store, giving the error message java.lang.RuntimeException: Could not list layers for this store, an error occurred retrieving them: Failed to create reader from [file]... There are other questions asked with this same error message, but my problem seems to be particular.

First: Let me say that this is an older version of GeoServer, version 2.12.1 (GeoTools 18.1), and an older GDAL, 1.11.4. We are doing this work in a secure facility, and getting upgrades approved and installed is a painful and lengthy process.

We are working on various sizes of GeoTIFFs, some of them quite large (30 GB+). The size makes no difference: we have tested this process on very small clipped TIFFs with the same results. But the original, unaltered GeoTIFFs are able to be added by GeoServer and render without a problem.

In order to optimize the GeoTIFFs, we first tile them using gdal_translate:

gdal_translate example.tif example_tiled.tif -co tiled=yes -co BLOCKXSIZE=512 =co BLOCKYSIZE=512

The resulting tiled GeoTIFF still works in GeoServer, is able to be added as a coverage and renders without an error.

Then we add overviews:

gdaladdo -r average example_tiled_overviews.tif 2 4 8 16 32 64 128

And then it no longer works; we get the above error message. We have tried all sorts of variations of the gdaladdo command: with and without interleaving, various sampling methods, leaving off all but the smallest overviews, external overviews -- but every time, it gives the same error message. So it works with overviews, but as soon as we add overviews, GeoServer can't handle it.

The TIFF with overviews is not corrupted. gdalinfo still gives correct information; the TIFF still is recognized and rendered in QGIS and is quite fast. We have access to a newer 2.x GDAL in QGIS on a Windows machine, and adding overviews with this makes no difference: the problem seems to be overviews, and it seems to be GeoServer.

Here is some sample gdalinfo of the final TIFF with overviews:

Driver: GTiff/GeoTIFF
Files: example_tiled_overviews.tif
Size is 129621, 90022
Coordinate System is:
        SPHEROID["WGS 84", 6378137,298.257223563,
Origin = (<redacted>,<redacted>)
Pixel Size = (0.000138888892252,-0.000138888892252)
Image Structure Metadata:
Corner Coordinates:
Upper Left   (  <redacted  ) (  <redacted>  )
Lower Left   (  <redacted  ) (  <redacted>  )
Upper Right  (  <redacted  ) (  <redacted>  )
Lower Right  (  <redacted  ) (  <redacted>  )
Center       (  <redacted  ) (  <redacted>  )
Band 1 Block 512x512 Type=Byte, ColorInterp=Red
  NoData Value=255
  Overviews: 64811x45011, 32406x22506, 16203x11253, 8102x5627, 4051x2814, 2026x1407, 1013x704
Band 2 Block 512x512 Type=Byte, ColorInterp=Green
  NoData Value=255
  Overviews: 64811x45011, 32406x22506, 16203x11253, 8102x5627, 4051x2814, 2026x1407, 1013x704
Band 3 Block 512x512 Type=Byte, ColorInterp=Blue
  NoData Value=255
  Overviews: 64811x45011, 32406x22506, 16203x11253, 8102x5627, 4051x2814, 2026x1407, 1013x704

A little bit of the stack trace from the error:

INFO [geoserver.web] - Getting list of coverages for saved file file:///geospatial_data/imagery/example_tiled_overviews.tif
java.lang.RuntimeException: Could not list layers for this store, an error occurred retrieving them: Failed to create reader from file:///geospatial_data/imagery/example_tiled_overviews.tif and hints Hints:
  EXECUTOR_SERVICE = java.util.concurrent.ThreadPoolExecutor@1e5c9246[Running, pool size = 5, active_threads = 0, queued tasks = 0, completed tasks = 9371]
  REPOSITORY       = org.geoserver.catalog.CatalogRepository@179e30bd

System defaults:
  COMPARISON_TOLERANCE             = 1.0E-8
  FILTER_FACTORY                   = FilterFactorImpl
  GRID_COVERAGE_FACTORY            = GridCoverageFactory
    TILE_ENCODING                  = null
  FEATURE_FACTORY                  = org.geotools.feature.LenientFeatureFactoryImpl@5bfa8cc5
  STYLE_FACTORY                    = StyleFactoryImpl
  LENIENT_DATUM_SHIFT              = true

at org.geoserver.web.data.layer.NewLayerPageProvider.getItemsInternal(NewLayerPageProvider.java:174)
at org.geoserver.web.data.layer.NewLayerPageProvider.getItems(NewLayerPageProvider.java:61)
at org.geoserver.web.wicket.GeoServerDataProvider.getFilteredItems(GeoServerDataProvider.java:216)
at org.geoserver.web.data.layer.NewLayerPageProvider.getFilteredItems(NewLayerPageProvider.java:189)
at org.geoserver.web.wicket.GeoServerDataProvider.size(GeoServerDataProvider.java:234)
at org.geoserver.web.wicket.GeoServerTablePanel$PagerDelegate.updateMatched(GeoServerTablePanel.java:617)
at org.geoserver.web.wicket.GeoServerTablePanel$PageDelegate.<init>(GeoServerTablePanel.java:610)
at org.geoserver.web.wicket.GeoServerTablePanel.<init>(GeoServerTablePanel.java:178)
at org.geoserver.web.wicket.GeoServerTablePanel.<init>(GeoServerTablePanel.java:99)
at org.geoserver.web.data.layer.NewLayerPage$1.<init>(NewLayerPage.java:110)
at org.geoserver.web.data.layer.NewLayerPage.<init>(NewLayerPage.java:110)
at org.geoserver.web.data.store.CoverageStoreNewPage.onSuccessfulSave(CoverageStoreNewPage.java:86)
at org.geoserver.web.data.store.CoverageStoreNewPage.onSave(CoverageStoreNewPage.java:74)
at org.geoserver.web.data.store.AbstractCoverageStorePage$1.onSubmit(AbstractCoverageStorePage.java:122)

Any ideas what is going on here?

UPDATE: I've re-examined the problem with the logging level turned up. I'm even more puzzled than before.

The first error that I see is an ArrayIndexOutOfBoundsException: 1:

WARN [class org.geotools.coverage.grid.io.imageio.MaskOverviewProvider] - Unable to create a Reader for File:
java.lang.ArrayIndexOutOfBoundsException: 1
at it.geosolutions.imageio.gdalframework.GDALImageReader.getDatasetMetadata(GDALImageReader.java:128)
at it.geosolutions.iamgeio.gdalframework.GDALImageReader.getWidth(GDALImageReader.java.1039)
at org.geotools.coverage.grid.io.iamgeio.MaskOverviewProvider.getOverviewResolutions(MaskOverviewProvider.java:482)
at org.geotools.gce.geotiff.GeoTiffReader.getHRInfo(GeoTiffReader.java:472)
at org.geotools.gce.geotiff.GeoTiffReader.<init>(GeoTiffReader.java:254)
at org.geotools.gce.geotiff.GeoTiffFormat.getReader(GeoTiffFormat.java:298)
at org.geotools.gce.geotiff.GeoTiffFormat.getReader(GeoTiffFormat.java:81)
Caused by: org.geotools.data.DataSourceException: java.lang.ArrayIndexOutOfBoundsException: 1
at org.geotools.gce.geotiff.GeoTiffReader.getHRInfo(GeoTiffReader.java:492)
at org.geotools.gce.geotiff.GeoTiffReader.<init>(GeoTiffReader.java:254)
Caused by: java.lang.IllegalArgumentException: java.lang.ArrayIndexOutOfBoundsException: 1
at org.geotools.coverage.grid.io.imageio.MaskOverviewProvider.getOverviewResolutions(MaskOverviewProvider.java:490)
at org.geotools.gce.geotiff.GeoTiffReader.getHRInfo(GeoTiffReader.java:472)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at it.geosolutions.imageio.gdalframework.GDALImageReader.getDatasetMetadata(GDALImageReader.java:128)
at it.geosolutions.imageio.gdalframework.GDALImageReader.getWidth(GDALImageReader.java:1039)
at org.geotools.coverage.grid.io.imageio.MaskOverviewProvider.getOverviewResolutions(MaskOverviewProvider.java:482)

It's only after this that I get the "Could not list layers for this store ... Failed to create reader" error.

The really strange thing is that we have a GeoServer at our base of operations with, we believe, exactly the same version and configuration as the one that we're having this problem on, and we don't see this problem there.

Does anybody have any idea?

  • can you add the "caused by" section of the stacktrace – Ian Turton Feb 15 '19 at 17:08
  • only oddity I see is taking overviews to 128 - I rarely go above 32 and would switch to an image pyramid if I needed a lot of overviews. – Ian Turton Feb 15 '19 at 17:09
  • @IanTurton: I don't see a "caused by" anywhere in the trace. – LonelyPilgrim Feb 15 '19 at 17:26
  • try turning logging upto GeoTools dev level – Ian Turton Feb 15 '19 at 17:27
  • 1
    The file is particularly large and not compressed, so I'm assuming it's a bigtiff (see bigtiff.org )... do you have the native imageio installed? That might be interfering with the ability to read bigtiff files. Also, you can try compressing your file (deflate or jpeg) and see if that helps. – Andrea Aime Feb 16 '19 at 10:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.