0

I use tile cache for my raster layers, but my configuration was probably not perfect because recently my GeoServer stopped working. I think it was due to a lack of available disk space. To get access to GeoServer again, I had to manually delete a raster cache. Since then I've had an error that I can't fix.

I get the following error:

Could not open JDBC Connection for transaction; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Unique index or primary key violation: PRIMARY_KEY_B ON PUBLIC.TILEPAGE(KEY); SQL statement: CREATE PRIMARY KEY ON PUBLIC.TILEPAGE(KEY) [23001-119]) 

Which is shown on the home page as soon as I log in as admin: enter image description here

I also get it on the disk quota page: enter image description here

My geoserver.log looks like this:

26 025 09:25:34 CONFIG [diskquota.ConfigLoader] - Quota config is: gwc/geowebcache-diskquota.xml 26 025 09:25:35 ERROR [geoserver.gwc] - Failed to get a quota store, the GeoWebCache disk quota subsystem will stop working now org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Unique index or primary key violation: PRIMARY_KEY_B ON PUBLIC.TILEPAGE(KEY); SQL statement: CREATE PRIMARY KEY ON PUBLIC.TILEPAGE(KEY) [23001-119]) at

and this:

Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Unique index or primary key violation: PRIMARY_KEY_B ON PUBLIC.TILEPAGE(KEY); SQL statement: CREATE PRIMARY KEY ON PUBLIC.TILEPAGE(KEY) [23001-119]) at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:261) ... 133 more Caused by: org.h2.jdbc.JdbcSQLException: Unique index or primary key violation: PRIMARY_KEY_B ON PUBLIC.TILEPAGE(KEY); SQL statement: CREATE PRIMARY KEY ON PUBLIC.TILEPAGE(KEY) [23001-119] at ... 136 more 26 025 09:25:36 CONFIG [diskquota.ConfigLoader] - Quota config is: gwc/geowebcache-diskquota.xml 26 025 09:25:36 INFO
[diskquota.DiskQuotaMonitor] - Shutting down clean up executor service... 26 025 09:25:36 CONFIG [diskquota.DiskQuotaMonitor] - Setting up disk quota periodic enforcement task 26 025 09:25:36 CONFIG [diskquota.DiskQuotaMonitor] - 0 layers configured with their own quotas. 26 025 09:25:36 CONFIG [diskquota.DiskQuotaMonitor] - 0 layers attached to global quota 1,0 GB 26 025 09:25:36 CONFIG [diskquota.DiskQuotaMonitor] - Disk quota periodic enforcement task set up every 10 SECONDS 26 025 09:25:36 ERROR [pageStore.DiskDataStore] - /opt/tomcat/work/Catalina/localhost/geoserver/wicket-filestore/4361/7388/47D04DF3AB2454477729C63332286386/data (Aucun fichier ou dossier de ce type) java.io.FileNotFoundException: /opt/tomcat/work/Catalina/localhost/geoserver/wicket-filestore/4361/7388/47D04DF3AB2454477729C63332286386/data (Aucun fichier ou dossier de ce type) at java.base/java.io.RandomAccessFile.open0(Native Method) at java.base/java.io.RandomAccessFile.open(RandomAccessFile.java:345) at java.base/java.io.RandomAccessFile.(RandomAccessFile.java:259) at java.base/java.io.RandomAccessFile.(RandomAccessFile.java:214) at org.apache.wicket.pageStore.DiskDataStore$SessionEntry.getFileChannel(DiskDataStore.java:428) at org.apache.wicket.pageStore.DiskDataStore$SessionEntry.savePage(DiskDataStore.java:346) at org.apache.wicket.pageStore.DiskDataStore.storeData(DiskDataStore.java:185) at org.apache.wicket.pageStore.AsynchronousDataStore$PageSavingRunnable.run(AsynchronousDataStore.java:355) at java.base/java.lang.Thread.run(Thread.java:829) 26 025 09:25:36 WARN [pageStore.DiskDataStore] - Cannot save page with id '9' because the data file cannot be opened. 26 025 09:25:36 ERROR [pageStore.DiskDataStore] - /opt/tomcat/work/Catalina/localhost/geoserver/wicket-filestore/4361/7388/47D04DF3AB2454477729C63332286386/data (Aucun fichier ou dossier de ce type) java.io.FileNotFoundException: /opt/tomcat/work/Catalina/localhost/geoserver/wicket-filestore/4361/7388/47D04DF3AB2454477729C63332286386/data (Aucun fichier ou dossier de ce type) at java.base/java.io.RandomAccessFile.open0(Native Method) at java.base/java.io.RandomAccessFile.open(RandomAccessFile.java:345) at java.base/java.io.RandomAccessFile.(RandomAccessFile.java:259) at java.base/java.io.RandomAccessFile.(RandomAccessFile.java:214) at org.apache.wicket.pageStore.DiskDataStore$SessionEntry.getFileChannel(DiskDataStore.java:428) at org.apache.wicket.pageStore.DiskDataStore$SessionEntry.savePage(DiskDataStore.java:346) at org.apache.wicket.pageStore.DiskDataStore.storeData(DiskDataStore.java:185) at org.apache.wicket.pageStore.AsynchronousDataStore$PageSavingRunnable.run(AsynchronousDataStore.java:355) at java.base/java.lang.Thread.run(Thread.java:829)

I tried to enable/disable disk quota and restarted Apache2 and Tomcat several times.

I use GeoServer 2.21.1 and it runs on Apache Tomcat 9 (running on Debian 11). How can I reconfigure my GeoServer so that it works as expected again?

1 Answer 1

1

Your H2 Database is broken:

org.h2.jdbc.JdbcSQLException: Unique index or primary key violation: PRIMARY_KEY_B ON PUBLIC.TILEPAGE(KEY); SQL statement: CREATE PRIMARY KEY ON PUBLIC.TILEPAGE(KEY)

probably when you deleted the cache on disk you didn't clear the quota database so there are now duplicate IDs in the table and so GeoServer can't create the primary key constraint.

Your best bet is to delete the quota database and start again.

4
  • Thank you for your answer Ian. How can I delete the quota database?
    – GisUser
    Commented Feb 26 at 10:07
  • rm or del depending on your operating system :-) It's somewhere in the gwc directory
    – Ian Turton
    Commented Feb 26 at 11:05
  • I deleted the diskquota.index.db file but I still get the same error. After deleting every file in the gwc directory, the error is still there but no new diskquota.index.db file is created. So I can not start again
    – GisUser
    Commented Feb 26 at 12:41
  • I finally managed to resolve the error. The quota database was duplicated in two different directories. I deleted them here first: /opt/tomcat/webapps/geoserver/data/gwc and later here: /opt/tomcat/temp/geowebcache Once the files were deleted (diskquota.trace.db, diskquota.index.db and diskquota.data.db), everything worked correctly.
    – GisUser
    Commented Jul 15 at 8:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.