0

Goal: Publish rasters stored in columns of PostGIS DB using GeoServer

GeoServer-version is 2.19.0 run inside a docker-container

I found the Image Mosaic JDBC-Extension and followed this post: Publishing PostGIS Rasters in GeoServer? but it is not working.

The error I get is this:

Could not list layers for this store, an error occurred retrieving them: Failed to create reader from file:/usr/local/tomcat/data/coverages/oek.pgraster.xml and hints Hints: REPOSITORY = org.geoserver.catalog.CatalogRepository@1dbbadd EXECUTOR_SERVICE = java.util.concurrent.ThreadPoolExecutor@6043eebf[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] System defaults: FILTER_FACTORY = FilterFactoryImpl LENIENT_DATUM_SHIFT = true GRID_COVERAGE_FACTORY = GridCoverageFactory TILE_ENCODING = null STYLE_FACTORY = StyleFactoryImpl COMPARISON_TOLERANCE = 1.0E-8 FORCE_AXIS_ORDER_HONORING = http FORCE_LONGITUDE_FIRST_AXIS_ORDER = true FEATURE_FACTORY = org.geotools.feature.LenientFeatureFactoryImpl@3b44827c

Here are my files:

oek.pgraster.xml:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE ImageMosaicJDBCConfig [
  <!ENTITY mapping PUBLIC "mapping"  "mapping.pgraster.xml.inc">
  <!ENTITY connect PUBLIC "connect"  "connect.postgis.xml.inc">
]>

<config version="1.0"> <coverageName name="oek"/> <coordsys name="EPSG:25832"/> <!-- interpolation 1 = nearest neighbour, 2 = bipolar, 3 = bicubic --> <scaleop interpolation="1"/> <axisOrder ignore="false"/> &mapping; &connect; </config>

mapping.pgraster.xml.inc:

<spatialExtension name="pgraster"/>
<mapping>
    <masterTable name="sentinel_2" >
        <coverageNameAttribute name="name"/>
        <x_swAttribute name="x_sw"/>
        <y_swAttribute name="y_sw"/>
        <b01Attribute name="b01"/>
        <b02_b03_b04_b08_mskAttribute name="b02_b03_b04_b08_msk"/>
        <b05_b06_b07_b8a_b11_b12_mskAttribute name="b05_b06_b07_b8a_b11_b12_msk"/>
        <sensing_dateAttribute name="sensing_date"/>
        <coregisteredAttribute name="coregistered"/>
        <s2_sensorAttribute name="s2_sensor"/>
        <s2_levelAttribute name="s2_level"/>
        <cloud_coverAttribute name="cloud_cover"/>
    </masterTable>
</mapping>

connect.postgis.xml.inc: (I replaced the user, password and host-IP)

<connect>
  <dstype value="DBCP"/>
  <username value="user" />
  <password value="password"/>
  <jdbcUrl value="jdbc:postgresql:HOST:PORT/ts_data"/>
  <driverClassName value="org.postgresql.Driver"/>
  <maxActive value="10"/>
  <maxIdle value="0"/>
</connect>

Logfiles:

2022-07-14 09:11:04,169 WARN [jdbc.datasource] - Could not acquire A BDCP connection pool.:org.geotools.data.DataSourceException: Connection pool improperly set up: Cannot create PoolableConnectionFactory (Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.) org.geotools.data.DataSourceException: Connection pool improperly set up: Cannot create PoolableConnectionFactory (Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.) at org.geotools.data.jdbc.datasource.DBCPDataSourceFactory.createNewDataSource(DBCPDataSourceFactory.java:107) at (......) 2022-07-14 09:11:04,195 INFO [geoserver.web] - Getting list of coverages for saved store file:/opt/geoserver/data_dir/coverages/oek.pgraster.xml java.lang.RuntimeException: Could not list layers for this store, an error occurred retrieving them: Failed to create reader from file:/opt/geoserver/data_dir/coverages/oek.pgraster.xml and hints Hints: REPOSITORY = org.geoserver.catalog.CatalogRepository@4eaa0b54 System defaults: FILTER_FACTORY = FilterFactoryImpl
LENIENT_DATUM_SHIFT = true
GRID_COVERAGE_FACTORY = GridCoverageFactory
TILE_ENCODING = null
STYLE_FACTORY = StyleFactoryImpl
COMPARISON_TOLERANCE = 1.0E-8
FORCE_AXIS_ORDER_HONORING = http
FORCE_LONGITUDE_FIRST_AXIS_ORDER = true
FEATURE_FACTORY = org.geotools.feature.LenientFeatureFactoryImpl@3b44827c
EXECUTOR_SERVICE = java.util.concurrent.ThreadPoolExecutor@6043eebf[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]

Felix
  • 165
  • 11
  • 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 Jul 14 '22 at 08:12
  • 1
    I added the logfiles, apparently the BDCP-connection tries to check localhost:5432 for the DB even though I configured it diffently in my connect.postgis.xml file. – Felix Jul 14 '22 at 09:15
  • My GeoServer-Container is running on the same host-machine as my DB now, still not able to connect. I changed the host:IP to //localhost:5432 in my connect-file. Any hints/directions @IanTurton? – Felix Jul 15 '22 at 09:05

0 Answers0