[Geoserver-devel] [JIRA] (GEOS-8905) Cannot add CSV Store

Torben Barsballe created an issue

GeoServer / BugGEOS-8905

Cannot add CSV Store

Issue Type:

BugBug

Affects Versions:

2.13.2

Assignee:

Unassigned

Created:

24/Aug/18 9:27 PM

Priority:

MediumMedium

Reporter:

Torben Barsballe

When trying to add a CSV store, I get the following error when publishing the layer:

[wicket portion ommited]
...
Caused by: java.lang.RuntimeException: Error occurred while building the resources for the configuration page
	at org.geoserver.web.data.layer.NewLayerPage.buildLayerInfo(NewLayerPage.java:435)
	at org.geoserver.web.data.layer.NewLayerPage$9.onClick(NewLayerPage.java:324)
	at org.geoserver.web.wicket.SimpleAjaxLink$1.onClick(SimpleAjaxLink.java:47)
	at org.apache.wicket.ajax.markup.html.AjaxLink$1.onEvent(AjaxLink.java:85)
	at org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:155)
	at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:601)
	... 105 more
Caused by: java.lang.RuntimeException: Failure reading csv file
	at org.geotools.data.csv.parse.CSVStrategy.createBuilder(CSVStrategy.java:80)
	at org.geotools.data.csv.parse.CSVAttributesOnlyStrategy.buildFeatureType(CSVAttributesOnlyStrategy.java:43)
	at org.geotools.data.csv.parse.CSVStrategy.getFeatureType(CSVStrategy.java:59)
	at org.geotools.data.csv.CSVDataStore.getSchema(CSVDataStore.java:77)
	at org.geotools.data.csv.CSVFeatureSource.buildFeatureType(CSVFeatureSource.java:94)
	at org.geotools.data.store.ContentFeatureSource.getAbsoluteSchema(ContentFeatureSource.java:328)
	at org.geotools.data.store.ContentFeatureSource.getSchema(ContentFeatureSource.java:297)
	at org.geotools.data.store.ContentFeatureSource.getSchema(ContentFeatureSource.java:106)
	at org.geoserver.catalog.CatalogBuilder.buildFeatureType(CatalogBuilder.java:343)
	at org.geoserver.catalog.CatalogBuilder.buildFeatureType(CatalogBuilder.java:326)
	at org.geoserver.web.data.layer.NewLayerPage.buildLayerInfo(NewLayerPage.java:425)
	... 110 more
Caused by: java.io.FileNotFoundException: file:/Users/tbarsballe/Downloads/locations.csv (No such file or directory)
	at java.io.FileInputStream.open0(Native Method)
	at java.io.FileInputStream.open(FileInputStream.java:195)
	at java.io.FileInputStream.<init>(FileInputStream.java:138)
	at java.io.FileReader.<init>(FileReader.java:72)
	at org.geotools.data.csv.CSVFileState.openCSVReader(CSVFileState.java:108)
	at org.geotools.data.csv.parse.CSVStrategy.createBuilder(CSVStrategy.java:76)
	... 120 more

Debugging into the issue a bit, I have determined the following:

  1. The CSV Data Store in GeoTools requires the filename to be of the form “/Users/tbarsballe/Downloads/locations.csv” (no protocol)
  2. The default data store handling in geoserver automatically prepends the protocol to the file connection parameter if you do not supply it, so if you try to save the DataStoreInfo with file = “/Users/tbarsballe/Downloads/locations.csv”, what actually gets saved is file = “file:///Users/tbarsballe/Downloads/locations.csv”.
  3. The CSV data store does no validity / connection checks when the store is first saved, so this issue doesn’t throw an error until you go to publish the layer.

CSV Data Store likely needs a custom store page implementation in geoserver for the UI to work, although the GeoTools store could also be updated to be more robust to support the protocol in the file path.

Add Comment

Add Comment

Get Jira notifications on your phone! Download the Jira Cloud app for Android or iOS


This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100090-sha1:68bb6c0)

Atlassian logo