description of the bug: I used to be able to simply setup a data store for a shapefile using a public facing AWS S3 URL for the Connection Parameters field and I could publish layers/services for it with no problem. That was version 2.16.0 of Geoserver (build date 18-Sep-2019).
However, on recent Geoserver deploys, the server mangles the URL and attempts to turn it into a file URL like this one for example:
file:///usr/local/tomcat/webapps/Geoserver/https:/myshapefiles.s3.amazonaws.com/testshapefile1.shp
Which, prevents successful Publishing.
-
-
- Reproduction Steps
Have a public S3 repo with a shapefile in it. For example:
https://usgs-shapefiles.s3.amazonaws.com/5e57f958bf0a3642014f3e6c/1790-1823_BlackCone_flow.shp
Try to use that URL for in the Connection Parameters Shapefile Location field when configuring a datastore.
Hit the Save button and then it will take you to “Layers” where you can “Publish” it.
After you hit “Publish”, you get a stacktrace:
Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: /var/www/geoserver/https:/usgs-shapefiles.s3.amazonaws.com/5e57f958bf0a3642014f3e6c/1790-1823_BlackCone_flow.shp (No such file or directory) at org.geotools.data.store.ContentFeatureSource.getAbsoluteSchema(ContentFeatureSource.java:329) at org.geotools.data.store.ContentFeatureSource.getSchema(ContentFeatureSource.java:296) at org.geotools.data.store.ContentFeatureSource.getSchema(ContentFeatureSource.java:105) at org.geoserver.catalog.CatalogBuilder.buildFeatureType(CatalogBuilder.java:342) at org.geoserver.catalog.CatalogBuilder.buildFeatureType(CatalogBuilder.java:325) at org.geoserver.web.data.layer.NewLayerPage.buildLayerInfo(NewLayerPage.java:413) ... 125 more
When you go back into the datastore (Edit), you will find that Geoserver mangled the original URL and turned it into a combination “file” and “http” URL, like this one:
file:///var/www/geoserver/https:/usgs-shapefiles.s3.amazonaws.com/5e57f958bf0a3642014f3e6c/1790-1823_BlackCone_flow.shp
If you attempt to Save again from the Edit page, you will get an error:
“Could not find file: file:///var/www/geoserver/https:/usgs-shapefiles.s3.amazonaws.com/5e57f958bf0a3642014f3e6c/1790-1823_BlackCone_flow.shp”
Of course, this is unpublishable.
This used to actually work in version 2.16.0 of Geoserver (build date 18-Sep-2019).
- Error Log
Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: /var/www/geoserver/https:/usgs-shapefiles.s3.amazonaws.com/5e57f958bf0a3642014f3e6c/1790-1823_BlackCone_flow.shp (No such file or directory) at org.geotools.data.store.ContentFeatureSource.getAbsoluteSchema(ContentFeatureSource.java:329) at org.geotools.data.store.ContentFeatureSource.getSchema(ContentFeatureSource.java:296) at org.geotools.data.store.ContentFeatureSource.getSchema(ContentFeatureSource.java:105) at org.geoserver.catalog.CatalogBuilder.buildFeatureType(CatalogBuilder.java:342) at org.geoserver.catalog.CatalogBuilder.buildFeatureType(CatalogBuilder.java:325) at org.geoserver.web.data.layer.NewLayerPage.buildLayerInfo(NewLayerPage.java:413) ... 125 more
- Environment
-JVM Version : Private Build: 1.8.0_242 (OpenJDK 64-Bit Server VM)
- CLI Version :
- Framework Version:
- OS : Ubuntu 18.04.4 LTS
`GeoServer Version
2.16.2
Git Revision
|