Torben,
the "java.sql.SQLException: The prepared statement has been finalized" is caused by failed error handling trying to double-finalize the prepared statement. The underlying cause is the SQLite extended result code 2067:
https://sqlite.org/rescode.html
(2067) SQLITE_CONSTRAINT_UNIQUE
The SQLITE_CONSTRAINT_UNIQUE error code is an extended error code for SQLITE_CONSTRAINT indicating that a UNIQUE constraint failed.
addGeometryColumnsEntry is called twice with these values:
[Seven, pointProperty, Point, 32615, 0, 0]
[Seven, boundedBy, Polygon, 32615, 0, 0]
but gpkg_geometry_columns.sql has the following constraint that limits each table to one geometry column:
CONSTRAINT uk_gc_table_name UNIQUE (table_name)
Kind regards,
Ben.
On 27/04/17 14:00, Ben Caradoc-Davies wrote:
Torben,
I also see these failures locally on master:
Failed tests:
testTileEntries(org.geoserver.geopkg.GeoPackageGetMapOutputFormatTest)
Tests in error:
testGetFeatureWithFilter(org.geoserver.geopkg.GeoPackageGetFeatureOutputFormatTest):
Error occurred creating table
testGetFeatureTwoTypes(org.geoserver.geopkg.GeoPackageGetFeatureOutputFormatTest):
Error occurred creating table
The root cause is "java.sql.SQLException: The prepared statement has
been finalized".
The first failure has the following stack trace :
Running org.geoserver.geopkg.GeoPackageGetFeatureOutputFormatTest
Tests run: 5, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 4.402
sec <<< FAILURE!
testGetFeatureWithFilter(org.geoserver.geopkg.GeoPackageGetFeatureOutputFormatTest)
Time elapsed: 3505 sec <<< ERROR!
java.io.IOException: Error occurred creating table
at org.geotools.jdbc.JDBCDataStore.createSchema(JDBCDataStore.java:800)
at org.geotools.geopkg.GeoPackage.create(GeoPackage.java:629)
at org.geotools.geopkg.GeoPackage.add(GeoPackage.java:654)
at
org.geoserver.geopkg.GeoPackageGetFeatureOutputFormat.write(GeoPackageGetFeatureOutputFormat.java:110)
at
org.geoserver.geopkg.GeoPackageGetFeatureOutputFormatTest.testGetFeature(GeoPackageGetFeatureOutputFormatTest.java:137)
at
org.geoserver.geopkg.GeoPackageGetFeatureOutputFormatTest.testGetFeatureWithFilter(GeoPackageGetFeatureOutputFormatTest.java:104)
[... omitting surefile/junit-related frames ...]
Caused by: java.sql.SQLException: java.io.IOException:
java.sql.SQLException: The prepared statement has been finalized
at
org.geotools.geopkg.GeoPkgDialect.postCreateTable(GeoPkgDialect.java:302)
at org.geotools.jdbc.JDBCDataStore.createSchema(JDBCDataStore.java:797)
... 39 more
Caused by: java.io.IOException: java.sql.SQLException: The prepared
statement has been finalized
at
org.geotools.geopkg.GeoPackage.addGeometryColumnsEntry(GeoPackage.java:932)
at
org.geotools.geopkg.GeoPkgDialect.postCreateTable(GeoPkgDialect.java:297)
... 40 more
Caused by: java.sql.SQLException: The prepared statement has been finalized
at org.sqlite.core.NativeDB.throwex(NativeDB.java:429)
at org.sqlite.core.NativeDB.reset(Native Method)
at
org.sqlite.jdbc3.JDBC3PreparedStatement.execute(JDBC3PreparedStatement.java:57)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
at
org.geotools.geopkg.GeoPackage.addGeometryColumnsEntry(GeoPackage.java:924)
... 41 more
Kind regards,
Ben.
On 27/04/17 11:29, Torben Barsballe wrote:
GeoServer side of the fix (WMS GeoPackage output format) here:
https://github.com/geoserver/geoserver/pull/2285
I still get a couple of GeoPackage tests failing, however they are
unrelated to the change and are also failing on master (and 2.11.x, 2.10.x,
2.9.x ... perhaps this is only failing on my machine?). I'm not having much
luck tracking down the root cause of those failures:
Tests in error:
testGetFeatureWithFilter(org.geoserver.geopkg.
GeoPackageGetFeatureOutputFormatTest): Error occurred creating table
testGetFeatureTwoTypes(org.geoserver.geopkg.GeoPackageGetFeatureOutputFormatTest):
Error occurred creating table
If anyone wants to test master locally, and see if those tests run for them
or are failing, that would be appreciated.
Torben
On Wed, Apr 26, 2017 at 1:17 PM, Torben Barsballe <
tbarsballe@anonymised.com> wrote:
I've discovered some interesting behaviour in the GeoPackage Raster Mosaic
implementation over the last few days.
I tried viewing a GeoPackage generated from the GeoServer GeoPackage WMS
output format in QGIS, and observed that tile order is reversed along the
y-axis.
QGIS used GDAL for parsing GeoPackages. After running this issue by the
GDAL team, I was directed to this line of the OGC GeoPackage spec
<http://www.geopackage.org/spec/#tile_matrix>:
The tile coordinate (0,0) always refers to the tile in the upper left
corner of the tile matrix at any zoom level, regardless of the actual
availability of that tile
Adding some test cases to the GeoTools GeoPackage plugin, I can confirm
that GeoTools gets this order wrong. Among other things, this means that
GeoTools / GeoServer will incorrectly read valid GeoPackage files. A fix
can be found here: https://github.com/geotools/geotools/pull/1567
Moving along to GeoServer, it appears there are similar problems with the
GeoServer GeoPackage Community module, namely in
the GeoPackageGetMapOutputFormat.
I believe I have a fix, but am currently being slowed down by the fact
that the GeoPackage module tests don't seem to be passing on master.
*This issue does bring up a problem*: Because GeoTools / GeoServer is
consistently wrong (a GeoPackage generated by GeoServer will be read in as
"correct"), this bug fix could cause problems for anyone who has solely
been using GeoPackage Rasters that were generated by GeoTools / GeoServer.
For more details:
https://osgeo-org.atlassian.net/browse/GEOT-5715
https://osgeo-org.atlassian.net/browse/GEOS-8112
https://trac.osgeo.org/gdal/ticket/6871
Torben
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel
--
Ben Caradoc-Davies <ben@anonymised.com>
Director
Transient Software Limited <http://transient.nz/>
New Zealand