GeoServer
  1. GeoServer
  2. GEOS-3404

Error - NoSuchElementException - Could not aquire feature:org.geotools.data.DataSourceException

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Not A Bug
    • Affects Version/s: 1.7.6
    • Fix Version/s: None
    • Component/s: WFS
    • Labels:
      None
    • Environment:
      1.7.6, windows Vista
    • Number of attachments :
      0

      Description

      I have a vector dataset stored in a MySQL table and am trying to do a WFS request on it with this URL:

      http://localhost:8080/geoserver/wfs?request=getfeature&service=wfs&version=1.1.0&typename=urban_region&outputFormat=GML3&cql_filter=INTERSECT(spatial_data,POLYGON((52.78429031372057 -3.8953366279600257,52.78429031372057 -2.6543542064157517,51.812992538486576 -2.6543542064157517,51.812992538486576 -3.8953366279600257,52.78429031372057 -3.8953366279600257)))

      However I get back this error:

      <ows:ExceptionText>java.util.NoSuchElementException: Could not aquire feature:org.geotools.data.DataSourceException: Error Performing SQL query: SELECT id_primary, CODE, LEGEND, FILE_NAME, NUMBER, NAME, NUMBER0, ADMIN_NAME, TYPE, FERRY_FROM, FERRY_TO, FERRY_TIME, FERRY_TYPE, RESTRICTIO, ACCESS, AMENDED, USAGE, LOCATION, GIS, OWNER, NORTH, SOUTH, EAST, WEST, CLOCKWISE, ANTICLOCKW, IMPERIAL, METRIC,
      AsText(spatial_data) AS spatial_data FROM urban_region Could not aquire feature:org.geotools.data.DataSourceException: Error Performing SQL query: SELECT id_primary, CODE, LEGEND, FILE_NAME, NUMBER, NAME, NUMBER0, ADMIN_NAME, TYPE, FERRY_FROM, FERRY_TO, FERRY_TIME, FERRY_TYPE, RESTRICTIO, ACCESS, AMENDED, USAGE, LOCATION, GIS, OWNER, NORTH, SOUTH, EAST, WEST, CLOCKWISE, ANTICLOCKW, IMPERIAL, METRIC, AsText(spatial_data) AS spatial_data FROM urban_region Error Performing SQL query: SELECT id_primary, CODE, LEGEND, FILE_NAME, NUMBER, NAME, NUMBER0, ADMIN_NAME, TYPE, FERRY_FROM, FERRY_TO, FERRY_TIME, FERRY_TYPE, RESTRICTIO, ACCESS, AMENDED, USAGE, LOCATION, GIS, OWNER, NORTH, SOUTH, EAST, WEST, CLOCKWISE, ANTICLOCKW, IMPERIAL, METRIC, AsText(spatial_data) AS spatial_data FROM urban_region
      You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near &apos;USAGE, LOCATION, GIS, OWNER, NORTH, SOUTH, EAST, WEST, CLOCKWISE, ANTICLOCKW, IM&apos; at line 1</ows:ExceptionText>

      Strangely, if I change output format to GML2 (all other formats produce the first error, above), I get a slightly different error:

      <ows:ExceptionText>
      error:Translator error Translator error Error reading Features Could not aquire feature:org.geotools.data.DataSourceException: Error Performing SQL query: SELECT id_primary, CODE, LEGEND, FILE_NAME, NUMBER, NAME, NUMBER0, ADMIN_NAME, TYPE, FERRY_FROM, FERRY_TO, FERRY_TIME, FERRY_TYPE, RESTRICTIO, ACCESS, AMENDED, USAGE, LOCATION, GIS, OWNER, NORTH, SOUTH, EAST, WEST, CLOCKWISE, ANTICLOCKW, IMPERIAL, METRIC, AsText(spatial_data) AS spatial_data FROM urban_region
      Error Performing SQL query: SELECT id_primary, CODE, LEGEND, FILE_NAME, NUMBER, NAME, NUMBER0, ADMIN_NAME, TYPE, FERRY_FROM, FERRY_TO, FERRY_TIME, FERRY_TYPE, RESTRICTIO, ACCESS, AMENDED, USAGE, LOCATION, GIS, OWNER, NORTH, SOUTH, EAST, WEST, CLOCKWISE, ANTICLOCKW, IMPERIAL, METRIC, AsText(spatial_data) AS spatial_data FROM urban_region
      You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USAGE, LOCATION, GIS, OWNER, NORTH, SOUTH, EAST, WEST, CLOCKWISE, ANTICLOCKW, IM' at line 1
      </ows:ExceptionText>

      I should note that the data displays fine in WMS, and that the same URL works perfectly when I use a different layer instead of urban_region.
      This may be an error with the dataset (again, it display fine in WMS though), but a quick google search shows this error has occured before in GeoServer before being fixed.

        Activity

        Hide
        Andrea Aime added a comment -

        Hmmm... the mysql datastore is pretty much abandoned, no one has been working on it since 1.5 years ago I think.
        First strange thing I've noticed is the "astext" usage... why is not the wkb support used? Should be enabled by default.

        Also, by looking at the query I have no idea why it's wrong, maybe one of the field names is a reserved character?
        Can you run the same query in a sql client and find exactly what's wrong with it.

        Show
        Andrea Aime added a comment - Hmmm... the mysql datastore is pretty much abandoned, no one has been working on it since 1.5 years ago I think. First strange thing I've noticed is the "astext" usage... why is not the wkb support used? Should be enabled by default. Also, by looking at the query I have no idea why it's wrong, maybe one of the field names is a reserved character? Can you run the same query in a sql client and find exactly what's wrong with it.
        Hide
        Jonathan added a comment -

        Good idea, I didn't realise it was displaying a full and valid MySQL query.
        I tried it and I got this error back:

        #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USAGE, LOCATION, GIS, OWNER, NORTH, SOUTH, EAST, WEST, CLOCKWISE, ANTICLOCKW, IM' at line 1
        SELECT id_primary, CODE, LEGEND, FILE_NAME, NUMBER, NAME, NUMBER0, ADMIN_NAME,
        TYPE , FERRY_FROM, FERRY_TO, FERRY_TIME, FERRY_TYPE, RESTRICTIO, ACCESS,
        USAGE , LOCATION, GIS, OWNER, NORTH, SOUTH, EAST, WEST, CLOCKWISE, ANTICLOCKW, IMPERIAL, METRIC, AsText( spatial_data ) AS spatial_data
        FROM urban_region
        LIMIT 0 , 30

        If I removed the "USAGE" part from the query it works fine. No idea why. There are 23,000 rows in the table, and that I can see all of them have absolutely no value in the "usage" column.
        MySQL is quite happy to select the contents of that row using other queries, so no clue what's happening.

        I dropped the USAGE column and tried the same WFS request, it now works fine. I'm guessing this means it's a MySQL bug and you can close.

        Show
        Jonathan added a comment - Good idea, I didn't realise it was displaying a full and valid MySQL query. I tried it and I got this error back: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USAGE, LOCATION, GIS, OWNER, NORTH, SOUTH, EAST, WEST, CLOCKWISE, ANTICLOCKW, IM' at line 1 SELECT id_primary, CODE, LEGEND, FILE_NAME, NUMBER, NAME, NUMBER0, ADMIN_NAME, TYPE , FERRY_FROM, FERRY_TO, FERRY_TIME, FERRY_TYPE, RESTRICTIO, ACCESS, USAGE , LOCATION, GIS, OWNER, NORTH, SOUTH, EAST, WEST, CLOCKWISE, ANTICLOCKW, IMPERIAL, METRIC, AsText( spatial_data ) AS spatial_data FROM urban_region LIMIT 0 , 30 If I removed the "USAGE" part from the query it works fine. No idea why. There are 23,000 rows in the table, and that I can see all of them have absolutely no value in the "usage" column. MySQL is quite happy to select the contents of that row using other queries, so no clue what's happening. I dropped the USAGE column and tried the same WFS request, it now works fine. I'm guessing this means it's a MySQL bug and you can close.
        Hide
        Andrea Aime added a comment -

        Not a bug in GS it seems

        Show
        Andrea Aime added a comment - Not a bug in GS it seems

          People

          • Assignee:
            Andrea Aime
            Reporter:
            Jonathan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: