SQL exception when querying Geopackage table containing a dot in the name

Description

When using a Geopackage file in Geoserver which has a feature table containing a dot, I'm getting the following exception:
[SQLITE_ERROR] SQL error or missing database (no such table: rtree_mosselzaadinvanginstallaties.mosselzaadinvanginstallaties_geom)

This exception is shown as part of an OGC Service exception with both WMS and WFS. The latter only when I'm specifying a bounding box.

My environment is Ubuntu Xenial, using Java 8, Tomcat 8.5.23 and Geoserver 2.12.0. I've originally reproduced this issue on Debian Jessie (in Docker), using Java 8, Tomcat 8.5.20 and Geoserver 2.12.0.

WMS:
Request: http://localhost:8080/geoserver/gpkg/wms?service=WMS&version=1.1.0&request=GetMap&layers=gpkg:mosselzaadinvanginstallaties.mosselzaadinvanginstallaties&styles=&bbox=634.5732789819012,306594.5543000576,284300.0254094796,636981.7698870846&width=659&height=768&srs=EPSG:28992&format=image/png

Result:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE ServiceExceptionReport SYSTEM "http://localhost:8080/geoserver/schemas/wms/1.1.1/WMS_exception_1_1_1.dtd"> <ServiceExceptionReport version="1.1.1" > <ServiceException code="internalError">
Rendering process failed
java.io.IOExceptionBorrow prepareStatement from pool failed
[SQLITE_ERROR] SQL error or missing database (no such table: rtree_mosselzaadinvanginstallaties.mosselzaadinvanginstallaties_geom)
</ServiceException></ServiceExceptionReport>

WFS:
Request: http://localhost:8080/geoserver/gpkg/wms?service=WFS&version=1.1.0&request=GetFeature&typename=gpkg:mosselzaadinvanginstallaties.mosselzaadinvanginstallaties&bbox=100000,500000,200000,600000

Result:
<ows:ExceptionReport xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://localhost:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd">
<ows:Exception exceptionCode="NoApplicableCode">
<ows:ExceptionText>java.lang.RuntimeException: java.io.IOException
java.io.IOExceptionBorrow prepareStatement from pool failed
[SQLITE_ERROR] SQL error or missing database (no such table: rtree_mosselzaadinvanginstallaties.mosselzaadinvanginstallaties_geom)</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>

This WFS request is returning GML: view-source:http://localhost:8080/geoserver/gpkg/wms?service=WFS&version=1.1.0&request=GetFeature&typename=gpkg:mosselzaadinvanginstallaties.mosselzaadinvanginstallaties

<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gpkg="http://example.com/gpkg" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" numberOfFeatures="80" timeStamp="2017-10-24T09:46:38.995Z" xsi:schemaLocation="http://www.opengis.net/wfs http://localhost:8080/geoserver/schemas/wfs/1.1.0/wfs.xsd http://example.com/gpkg http://localhost:8080/geoserver/gpkg/wfs?service=WFS&amp;version=1.1.0&amp;request=DescribeFeatureType&amp;typeName=gpkg%3Amosselzaadinvanginstallaties.mosselzaadinvanginstallaties">
<gml:featureMembers>
<gpkg:mosselzaadinvanginstallaties.mosselzaadinvanginstallaties gml:id="mosselzaadinvanginstallaties.mosselzaadinvanginstallaties.1">
<gpkg:geom>
<gmlolygon srsName="urn:x-ogc:def:crs:EPSG:28992" srsDimension="2">
<gml:exterior>
<gml:LinearRing>
<gmlosList>39651.59818981 404463.74698666 39659.06035033 404356.84855453 39760.29956985 404363.65977777 40261.53876859 404396.30095864 40253.15530496 404505.89005741 39651.59818981 404463.74698666</gmlosList>
</gml:LinearRing>
</gml:exterior>
</gmlolygon>
</gpkg:geom>
<gpkg:gid>1</gpkg:gid>
<gpkg:legenda>MZI percelen uitgegeven door Productschap mosselen</gpkg:legenda>
<gpkg:locatienaam>NJ 6</gpkg:locatienaam>
<gpkg:objectid>1</gpkg:objectid>
</gpkg:mosselzaadinvanginstallaties.mosselzaadinvanginstallaties>
<!-- Other features are omitted -->
</gml:featureMembers>
</wfs:FeatureCollection>

This issue was originally mentioned on geoserver-users by me:https://sourceforge.net/p/geoserver/mailman/message/36084164/
At that time I was looking into a different geopackage file (mosselenoesterhabitats), but the file I'm mentioning here is even smaller.

Environment

None

Status

Assignee

Ian Turton

Reporter

Frank Steggink

Triage

None

Fix versions

Priority

Medium
Configure