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 [geoserver.rest] -
java.lang.RuntimeException: java.lang.IllegalStateException: Transaction has been closed
        at org.geotools.jdbc.JDBCFeatureSource.getBoundsInternal(JDBCFeatureSource.java:541)
        at org.geotools.jdbc.JDBCFeatureStore.getBoundsInternal(JDBCFeatureStore.java:190)
        at org.geotools.data.store.ContentFeatureSource.getBounds(ContentFeatureSource.java:444)
        at org.geotools.data.transform.TransformFeatureSource.getBounds(TransformFeatureSource.java:225)
        at org.geotools.data.transform.TransformFeatureSource.getBounds(TransformFeatureSource.java:186)
        at org.geotools.gce.imagemosaic.catalog.GTDataStoreGranuleCatalog.getBounds(GTDataStoreGranuleCatalog.java:551)
        at org.geotools.gce.imagemosaic.catalog.CachingDataStoreGranuleCatalog.getBounds(CachingDataStoreGranuleCatalog.java:123)
        at org.geotools.gce.imagemosaic.RasterManager.initialize(RasterManager.java:1491)
        at org.geotools.gce.imagemosaic.ImageMosaicReader.harvest(ImageMosaicReader.java:1297)
        at org.geoserver.catalog.CoverageDimensionCustomizerReader$CoverageDimensionCustomizerStructuredReader.harvest(CoverageDimensionCustomizerReader.java:137)
        at org.geoserver.catalog.rest.CoverageStoreFileResource.handlePost(CoverageStoreFileResource.java:98)
        at org.restlet.Finder.handle(Finder.java:296)
        at org.geoserver.rest.BeanDelegatingRestlet.handle(BeanDelegatingRestlet.java:38)
        at org.restlet.Filter.doHandle(Filter.java:105)
...

Caused by: java.lang.IllegalStateException: Transaction has been closed
        at org.geotools.data.DefaultTransaction.getState(DefaultTransaction.java:157)
        at org.geotools.jdbc.JDBCDataStore.getConnection(JDBCDataStore.java:2032)
        at org.geotools.jdbc.JDBCDataStore.getConnection(JDBCDataStore.java:2053)
        at org.geotools.jdbc.JDBCFeatureSource.getBoundsInternal(JDBCFeatureSource.java:530)

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, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users