ImageMosaic REST API with DataStoreWrapper

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

ImageMosaic REST API with DataStoreWrapper

György Tomcsányi
Hi all,

I am trying to add files to an ImageMosaic store using the REST API:
curl -v -u admin:xxx -XPOST -H "Content-type: text/plain" -d "file:/path/to/file/xxx.tiff" "http://localhost:8180/geoserver/rest/workspaces/ws/coveragestores/mosaic_test/external.imagemosaic"

If I use Postgis with default configuration it works correctly, but it fails with Oracle:
< HTTP/1.1 500
< Transfer-Encoding: chunked
< Date: Wed, 15 Mar 2017 08:40:52 GMT
< Connection: close
* Closing connection #0
java.lang.IllegalStateException: Transaction has been closed

Stacktrace from the geoserver logs:
2017-03-15 08:26:45,063 ERROR [] -
java.lang.RuntimeException: java.lang.IllegalStateException: Transaction has been closed
        at org.geotools.jdbc.JDBCFeatureSource.getBoundsInternal(
        at org.geotools.jdbc.JDBCFeatureStore.getBoundsInternal(
        at org.geotools.gce.imagemosaic.catalog.GTDataStoreGranuleCatalog.getBounds(
        at org.geotools.gce.imagemosaic.catalog.CachingDataStoreGranuleCatalog.getBounds(
        at org.geotools.gce.imagemosaic.RasterManager.initialize(
        at org.geotools.gce.imagemosaic.ImageMosaicReader.harvest(
        at org.geoserver.catalog.CoverageDimensionCustomizerReader$CoverageDimensionCustomizerStructuredReader.harvest(
        at org.restlet.Finder.handle(
        at org.restlet.Filter.doHandle(

Caused by: java.lang.IllegalStateException: Transaction has been closed
        at org.geotools.jdbc.JDBCDataStore.getConnection(
        at org.geotools.jdbc.JDBCDataStore.getConnection(
        at org.geotools.jdbc.JDBCFeatureSource.getBoundsInternal(

After some debugging I suspect that this is caused by DataStoreWrapper.getFeatureSource in GTDataStoreGranuleCatalog. OracleDatastoreWrapper.transformFeatureStore returns a SimpleFeatureSource which has a JDBCFeatureStore with the same (closed) instance of DefaultTransaction for every REST call.

I have managed to reproduce the same behavior with Postgis by setting WrapStore=true in indexer.xml. When using Oracle this flag is ignored and the wrapped store is always used.

Does anyone have experience with a similar use case? Is there something I can change in the configuration to make it work? Is this a bug?

I am using Geoserver 2.10.2, GeoTools 16.2.

Looking forward to any suggestions,
best regards,

Gyorgy Tomcsanyi

Check out the vibrant tech community on one of the world's most
engaging tech sites,!
GeoTools-GT2-Users mailing list
[hidden email]