0

GeoServer => 2.20.1 (Jetty)

PostgreSQL => "PostgreSQL 13.3, compiled by Visual C++ build 1914, 64-bit"

PostGIS => "POSTGIS=""3.1.2 3.1.2"" [EXTENSION] PGSQL=""130"" GEOS=""3.9.1-CAPI-1.14.1"" SFCGAL=""1.3.8"" PROJ=""7.1.1"" LIBXML=""2.9.9"" LIBJSON=""0.12"" LIBPROTOBUF=""1.2.1"" WAGYU=""0.5.0 (Internal)"" TOPOLOGY"

I have a localhost PostgreSQL database called dfdb which I can access using qGIS and pgAdmin 4 (next image):

pgAdmin Accessing dfdb database on localhost

GeoServer Store PostGIS parameters.

enter image description here

When I try to create this Store in GeoServer (localhost database dfdb) I get the following error:

Error creating data store, check the parameters. Error message: Unable to obtain connection: Cannot create PoolableConnectionFactory (FATAL: database "dfdb" does not exist)

Can anyone help me work out what is going on?

I had a look at other solutions to connection issues but I couldn't work out if they applied in my case.

Turning on developer logging I get (seubset):

    at java.base/java.lang.Thread.run(Thread.java:831)

Caused by: java.lang.RuntimeException: Unable to obtain connection: Cannot create PoolableConnectionFactory (FATAL: database "dfdb" does not exist)

    at org.geotools.jdbc.JDBCDataStore.createConnection(JDBCDataStore.java:2147)

    at org.geotools.jdbc.JDBCDataStore.createTypeNames(JDBCDataStore.java:934)

    at org.geotools.data.store.ContentDataStore.getTypeNames(ContentDataStore.java:261)

    at org.vfny.geoserver.util.DataStoreUtils.getDataAccess(DataStoreUtils.java:73)

    at org.geoserver.catalog.ResourcePool.getDataStore(ResourcePool.java:626)

    ... 146 more

Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (FATAL: database "dfdb" does not exist)

    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.geotools.data.jdbc.datasource.AbstractManageableDataSource.getConnection(AbstractManageableDataSource.java:42)

    at org.geotools.jdbc.JDBCDataStore.createConnection(JDBCDataStore.java:2131)

    ... 150 more

Caused by: org.postgresql.util.PSQLException: FATAL: database "dfdb" does not exist

    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2553)

    at org.postgresql.core.v3.QueryExecutorImpl.readStartupMessages(QueryExecutorImpl.java:2665)

    at org.postgresql.core.v3.QueryExecutorImpl.<init>(QueryExecutorImpl.java:147)

    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:273)

    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51)

    at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:223)

    at org.postgresql.Driver.makeConnection(Driver.java:465)

    at org.postgresql.Driver.connect(Driver.java:264)

    at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)

    at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)

    at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)

    at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)

    ... 154 more
6
  • 1
    You need to turn up the logging level to developer in the global settings page, and then make the request again. Then edit your question with the relevant part of the log file.
    – Ian Turton
    Dec 18 '21 at 8:49
  • what settings did you use in GeoServer? are they exactly the same as in PGAdmin?
    – Ian Turton
    Dec 21 '21 at 11:17
  • I have added another image showing the Store database connection properties to my original request. Dec 22 '21 at 3:43
  • I still have no solution. I suspect the issue is less to do with GeoServer but more to do with the database driver not being able to connect to non-default databases. Jan 5 at 4:35
  • How geoserver and postgresql is running? Docker etc?
    – GSienko
    Jan 6 at 23:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.