[Geoserver-users] imagemosaic.jdbc : an explanation for "Could not list layers for this store"

Hi,

So why to play with the defaults of the databases at all? Wouldn’t it be much more reliable to use quoted identifiers everywhere and always? This way the result should be exactly the same for PostgreSQL, Oracle, SQL Server, SQLite, and others.

create table “MOSAIC” (“NAME” varchar(254) not null, “TileTable” varchar(254)not null, “minX” FLOAT8,“minY” FLOAT8, “maxX” FLOAT8, “maxY” FLOAT8,“resX” FLOAT8, “resY” FLOAT8, primary key (“NAME”,“TileTable”));

-Jukka Rahkonen-

Christian Mueller wrote:

···

Hi Ernest

XML names are case sensitive.

Different databases have different defaults.

PostGres converts DB names to lowercase

DB2 or Oracle convert DB names to uppercase

Cheers

Christian

On Mon, Jan 25, 2016 at 11:19 AM, Ernest CHIARELLO <ernest.chiarello@…7414…> wrote:

Hello everybody,

i recently experimented a geoserver failure when i tried to use the imagemosaic-jdbc plugin.
the catalina.out file contained the following lines :

Caused by: java.lang.NullPointerException
at org.geotools.gce.imagemosaic.jdbc.Config.readNameAttribute(Config.java:329)
at org.geotools.gce.imagemosaic.jdbc.Config.readNameString(Config.java:298)
at org.geotools.gce.imagemosaic.jdbc.Config.readMapping(Config.java:201)
at org.geotools.gce.imagemosaic.jdbc.Config.readFrom(Config.java:189)
at org.geotools.gce.imagemosaic.jdbc.ImageMosaicJDBCReader.<init>(ImageMosaicJDBCReader.java:133)
... 133 more
25 janv. 09:41:35 INFO [geoserver.web] - Getting list of coverages for saved store file:coverages/france_pgraster.xml
java.lang.RuntimeException: Could not list layers for this store, an error occurred retrieving them: Failed to create reader from file:coverages/france_pgraster.xml and hints null

whereas the mapping.pgraster.xml.inc file contained the following xml statement :

<spatialextension name="pgraster"/>
<mapping>
<mastertable name="mosaic" >
<coveragenameattribute name="name"/>
<maxxattribute name="maxx"/>
<maxyattribute name="maxy"/>
<minxattribute name="minx"/>
<minyattribute name="miny"/>
<resxattribute name="resx"/>
<resyattribute name="resy"/>
<tiletablenameatribute name="tiletable" />
</mastertable>
<tiletable>
<blobattributename name="rast" />
</tiletable>
</mapping>

why did geoserver failed ?
because it expects the string “maxXAttribute” and not “maxxattribute”… !

i made this mistake because i prefer using only lower case when i work with postgresql, and consequently,
i used the bash command “tr [A-Z] [a-z]” to transform the original mapping.pgraster.xml.inc file, proposed here :
http://docs.geotools.org/latest/userguide/library/coverage/pgraster.html
it was stupid, i was too hasty !

indeed, the original file in the documentation proposes this XML statement :

<spatialExtension name="pgraster"/>
 <mapping>
      <masterTable name="MOSAIC" >
              <coverageNameAttribute name="NAME"/>
              <maxXAttribute name="maxX"/>
              <maxYAttribute name="maxY"/>
              <minXAttribute name="minX"/>
              <minYAttribute name="minY"/>
              <resXAttribute name="resX"/>
              <resYAttribute name="resY"/>
              <tileTableNameAtribute  name="TileTable" />
      </masterTable>
      <tileTable>
              <blobAttributeName name="rast" />
      </tileTable>
</mapping>

you can see that according to this XML code, the table should be named “MOSAIC” and not “mosaic”.
but PostgreSQL will not do that !

look at this create table query :

create table MOSAIC (NAME varchar(254) not null, TileTable varchar(254)not null, minX FLOAT8,minY FLOAT8, maxX FLOAT8, maxY FLOAT8,resX FLOAT8, resY FLOAT8, primary key (NAME,TileTable));

the resulting table is :

geoserver=> \d mosaic;
Table « public.mosaic »
Colonne | Type | Modificateurs
-----------+------------------------+---------------
name | character varying(254) | non NULL
tiletable | character varying(254) | non NULL
minx | double precision |
miny | double precision |
maxx | double precision |
maxy | double precision |
resx | double precision |
resy | double precision |
Index :
"mosaic_pkey" PRIMARY KEY, btree (name, tiletable)

where you can see that all strings are lower case. consequently, i think it is better to write everything in lower case, like that :

create table mosaic (name varchar(254) not null, tiletable varchar(254) not null, minx float8, miny float8, maxx float8, maxyfloat8, resx float8, resy float8, primary key (name, tiletable));

and finally, you will use the following XML statement in the mapping.pgraster.xml.inc file :

<spatialExtension name="pgraster"/>
<mapping>
<masterTable name="mosaic" >
<coverageNameAttribute name="name"/>
<maxXAttribute name="maxx"/>
<maxYAttribute name="maxy"/>
<minXAttribute name="minx"/>
<minYAttribute name="miny"/>
<resXAttribute name="resx"/>
<resYAttribute name="resy"/>
<tileTableNameAtribute name="tiletable" />
</masterTable>
<tileTable>
<blobAttributeName name="rast" />
</tileTable>
</mapping>

hope this helps…

Ernest.

-- 
Ernest CHIARELLO  -  [Ernest.Chiarello@...7414...](mailto:Ernest.Chiarello@...7414...)
UMR6049 ThéMA - Théoriser et Modiliser pour Aménager
CNRS / université de Bourgogne Franche-Comté
32 rue Mégevand 25030 BESANÇON Cedex

Tel : 03 81 66 54 80           Mob : 07 82 99 11 08



Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140


Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

DI Christian Mueller MSc (GIS), MSc (IT-Security)

OSS Open Source Solutions GmbH

Hi Jukka, Hi Christian,

but if pgraster is only for PostgreSQL/GIS, then it is easier to use only lowercase... :wink:

thanks for this plugin, Christian !

sincerly yours,

Ernest.

Le 25/01/2016 12:38, Rahkonen Jukka (MML) a écrit :

Hi,

So why to play with the defaults of the databases at all? Wouldn’t it be much more reliable to use quoted identifiers everywhere and always? This way the result should be exactly the same for PostgreSQL, Oracle, SQL Server, SQLite, and others.

create table "MOSAIC" ("NAME" varchar(254) not null, "TileTable" varchar(254)not null, "minX" FLOAT8,"minY" FLOAT8, "maxX" FLOAT8, "maxY" FLOAT8,"resX" FLOAT8, "resY" FLOAT8, primary key ("NAME","TileTable"));

-Jukka Rahkonen-

Christian Mueller wrote:

Hi Ernest

XML names are case sensitive.

Different databases have different defaults.

PostGres converts DB names to lowercase

DB2 or Oracle convert DB names to uppercase

Cheers

Christian

On Mon, Jan 25, 2016 at 11:19 AM, Ernest CHIARELLO <ernest.chiarello@anonymised.com <mailto:ernest.chiarello@anonymised.com>> wrote:

    Hello everybody,

    i recently experimented a geoserver failure when i tried to use
    the imagemosaic-jdbc plugin.
    the catalina.out file contained the following lines :

    Caused by: java.lang.NullPointerException
            at
    org.geotools.gce.imagemosaic.jdbc.Config.readNameAttribute(Config.java:329)
            at
    org.geotools.gce.imagemosaic.jdbc.Config.readNameString(Config.java:298)
            at
    org.geotools.gce.imagemosaic.jdbc.Config.readMapping(Config.java:201)
            at
    org.geotools.gce.imagemosaic.jdbc.Config.readFrom(Config.java:189)
            at
    org.geotools.gce.imagemosaic.jdbc.ImageMosaicJDBCReader.<init>(ImageMosaicJDBCReader.java:133)
            ... 133 more
    25 janv. 09:41:35 INFO [geoserver.web] - Getting list of coverages
    for saved store file:coverages/france_pgraster.xml
    java.lang.RuntimeException: Could not list layers for this store,
    an error occurred retrieving them: Failed to create reader from
    file:coverages/france_pgraster.xml and hints null

    whereas the mapping.pgraster.xml.inc file contained the following
    xml statement :

    <spatialextension name="pgraster"/>
    <mapping>
          <mastertable name="mosaic" >
                  <coveragenameattribute name="name"/>
                  <maxxattribute name="maxx"/>
                  <maxyattribute name="maxy"/>
                  <minxattribute name="minx"/>
                  <minyattribute name="miny"/>
                  <resxattribute name="resx"/>
                  <resyattribute name="resy"/>
                  <tiletablenameatribute name="tiletable" />
          </mastertable>
          <tiletable>
                  <blobattributename name="rast" />
          </tiletable>
    </mapping>

    why did geoserver failed ?
    because it expects the string "maxXAttribute" and not
    "maxxattribute"... !

    i made this mistake because i prefer using only lower case when i
    work with postgresql, and consequently,
    i used the bash command "tr [A-Z] [a-z]" to transform the original
    mapping.pgraster.xml.inc file, proposed here :
    http://docs.geotools.org/latest/userguide/library/coverage/pgraster.html
    it was stupid, i was too hasty !

    indeed, the original file in the documentation proposes this XML
    statement :

    <spatialExtension name="pgraster"/>

      <mapping>

           <masterTable name="MOSAIC" >

                   <coverageNameAttribute name="NAME"/>

                   <maxXAttribute name="maxX"/>

                   <maxYAttribute name="maxY"/>

                   <minXAttribute name="minX"/>

                   <minYAttribute name="minY"/>

                   <resXAttribute name="resX"/>

                   <resYAttribute name="resY"/>

                   <tileTableNameAtribute name="TileTable" />

           </masterTable>

           <tileTable>

                   <blobAttributeName name="rast" />

           </tileTable>

    </mapping>

    you can see that according to this XML code, the table should be
    named "MOSAIC" and not "mosaic".
    but PostgreSQL will not do that !

    look at this create table query :

    create table MOSAIC (NAME varchar(254) not null, TileTable
    varchar(254)not null, minX FLOAT8,minY FLOAT8, maxX FLOAT8, maxY
    FLOAT8,resX FLOAT8, resY FLOAT8, primary key (NAME,TileTable));

    the resulting table is :

    geoserver=> \d mosaic;
                  Table « public.mosaic »
      Colonne | Type | Modificateurs
    -----------+------------------------+---------------
     name | character varying(254) | non NULL
     tiletable | character varying(254) | non NULL
     minx | double precision |
     miny | double precision |
     maxx | double precision |
     maxy | double precision |
     resx | double precision |
     resy | double precision |
    Index :
        "mosaic_pkey" PRIMARY KEY, btree (name, tiletable)

    where you can see that all strings are lower case. consequently, i
    think it is better to write everything in lower case, like that :

    create table mosaic (name varchar(254) not null, tiletable
    varchar(254) not null, minx float8, miny float8, maxx float8,
    maxyfloat8, resx float8, resy float8, primary key (name, tiletable));

    and finally, you will use the following XML statement in the
    mapping.pgraster.xml.inc file :

    <spatialExtension name="pgraster"/>
    <mapping>
          <masterTable name="mosaic" >
                  <coverageNameAttribute name="name"/>
                  <maxXAttribute name="maxx"/>
                  <maxYAttribute name="maxy"/>
                  <minXAttribute name="minx"/>
                  <minYAttribute name="miny"/>
                  <resXAttribute name="resx"/>
                  <resYAttribute name="resy"/>
                  <tileTableNameAtribute name="tiletable" />
          </masterTable>
          <tileTable>
                  <blobAttributeName name="rast" />
          </tileTable>
    </mapping>

    hope this helps...

    Ernest.

    --

    Ernest CHIARELLO - Ernest.Chiarello@anonymised.com
    <mailto:Ernest.Chiarello@anonymised.com>

    UMR6049 ThéMA - Théoriser et Modiliser pour Aménager

    CNRS / université de Bourgogne Franche-Comté

    32 rue Mégevand 25030 BESANÇON Cedex

    Tel : 03 81 66 54 80 Mob : 07 82 99 11 08

    ------------------------------------------------------------------------------
    Site24x7 APM Insight: Get Deep Visibility into Application Performance
    APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
    Monitor end-to-end web transactions and take corrective actions now
    Troubleshoot faster and improve end-user experience. Signup Now!
    http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
    _______________________________________________
    Geoserver-users mailing list
    Geoserver-users@lists.sourceforge.net
    <mailto:Geoserver-users@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/geoserver-users

--

DI Christian Mueller MSc (GIS), MSc (IT-Security)

OSS Open Source Solutions GmbH

--
Ernest CHIARELLO - Ernest.Chiarello@anonymised.com
UMR6049 ThéMA - Théoriser et Modéliser pour Aménager
CNRS / université de Bourgogne Franche-Comté
32 rue Mégevand 25030 BESANÇON Cedex

Tel : 03 81 66 54 80 Mob : 07 82 99 11 08

Hi Jukka

Quoting would be a solution, but if you work with command line DB tools it is harder to find the table and write SQL statements. (Most people do not quote the table and attribute names).

No preferences from my side.

Cheers
Christian

···

On Mon, Jan 25, 2016 at 2:56 PM, Chiarello Ernest <Ernest.Chiarello@anonymised.com> wrote:

Hi Jukka, Hi Christian,

but if pgraster is only for PostgreSQL/GIS, then it is easier to use only lowercase… :wink:

thanks for this plugin, Christian !

sincerly yours,

Ernest.

Le 25/01/2016 12:38, Rahkonen Jukka (MML) a écrit :

Hi,

So why to play with the defaults of the databases at all? Wouldn’t it be much more reliable to use quoted identifiers everywhere and always? This way the result should be exactly the same for PostgreSQL, Oracle, SQL Server, SQLite, and others.

create table “MOSAIC” (“NAME” varchar(254) not null, “TileTable” varchar(254)not null, “minX” FLOAT8,“minY” FLOAT8, “maxX” FLOAT8, “maxY” FLOAT8,“resX” FLOAT8, “resY” FLOAT8, primary key (“NAME”,“TileTable”));

-Jukka Rahkonen-

Christian Mueller wrote:

Hi Ernest

XML names are case sensitive.

Different databases have different defaults.

PostGres converts DB names to lowercase

DB2 or Oracle convert DB names to uppercase

Cheers

Christian

On Mon, Jan 25, 2016 at 11:19 AM, Ernest CHIARELLO <ernest.chiarello@anonymised.com> wrote:

Hello everybody,

i recently experimented a geoserver failure when i tried to use the imagemosaic-jdbc plugin.
the catalina.out file contained the following lines :

Caused by: java.lang.NullPointerException
at org.geotools.gce.imagemosaic.jdbc.Config.readNameAttribute(Config.java:329)
at org.geotools.gce.imagemosaic.jdbc.Config.readNameString(Config.java:298)
at org.geotools.gce.imagemosaic.jdbc.Config.readMapping(Config.java:201)
at org.geotools.gce.imagemosaic.jdbc.Config.readFrom(Config.java:189)
at org.geotools.gce.imagemosaic.jdbc.ImageMosaicJDBCReader.<init>(ImageMosaicJDBCReader.java:133)
... 133 more
25 janv. 09:41:35 INFO [geoserver.web] - Getting list of coverages for saved store file:coverages/france_pgraster.xml
java.lang.RuntimeException: Could not list layers for this store, an error occurred retrieving them: Failed to create reader from file:coverages/france_pgraster.xml and hints null

whereas the mapping.pgraster.xml.inc file contained the following xml statement :

<spatialextension name="pgraster"/>
<mapping>
<mastertable name="mosaic" >
<coveragenameattribute name="name"/>
<maxxattribute name="maxx"/>
<maxyattribute name="maxy"/>
<minxattribute name="minx"/>
<minyattribute name="miny"/>
<resxattribute name="resx"/>
<resyattribute name="resy"/>
<tiletablenameatribute name="tiletable" />
</mastertable>
<tiletable>
<blobattributename name="rast" />
</tiletable>
</mapping>

why did geoserver failed ?
because it expects the string “maxXAttribute” and not “maxxattribute”… !

i made this mistake because i prefer using only lower case when i work with postgresql, and consequently,
i used the bash command “tr [A-Z] [a-z]” to transform the original mapping.pgraster.xml.inc file, proposed here :
http://docs.geotools.org/latest/userguide/library/coverage/pgraster.html
it was stupid, i was too hasty !

indeed, the original file in the documentation proposes this XML statement :

<spatialExtension name="pgraster"/>
 <mapping>
      <masterTable name="MOSAIC" >
              <coverageNameAttribute name="NAME"/>
              <maxXAttribute name="maxX"/>
              <maxYAttribute name="maxY"/>
              <minXAttribute name="minX"/>
              <minYAttribute name="minY"/>
              <resXAttribute name="resX"/>
              <resYAttribute name="resY"/>
              <tileTableNameAtribute  name="TileTable" />
      </masterTable>
      <tileTable>
              <blobAttributeName name="rast" />
      </tileTable>
</mapping>

you can see that according to this XML code, the table should be named “MOSAIC” and not “mosaic”.
but PostgreSQL will not do that !

look at this create table query :

create table MOSAIC (NAME varchar(254) not null, TileTable varchar(254)not null, minX FLOAT8,minY FLOAT8, maxX FLOAT8, maxY FLOAT8,resX FLOAT8, resY FLOAT8, primary key (NAME,TileTable));

the resulting table is :

geoserver=> \d mosaic;
Table « public.mosaic »
Colonne | Type | Modificateurs
-----------+------------------------+---------------
name | character varying(254) | non NULL
tiletable | character varying(254) | non NULL
minx | double precision |
miny | double precision |
maxx | double precision |
maxy | double precision |
resx | double precision |
resy | double precision |
Index :
"mosaic_pkey" PRIMARY KEY, btree (name, tiletable)

where you can see that all strings are lower case. consequently, i think it is better to write everything in lower case, like that :

create table mosaic (name varchar(254) not null, tiletable varchar(254) not null, minx float8, miny float8, maxx float8, maxyfloat8, resx float8, resy float8, primary key (name, tiletable));

and finally, you will use the following XML statement in the mapping.pgraster.xml.inc file :

<spatialExtension name="pgraster"/>
<mapping>
<masterTable name="mosaic" >
<coverageNameAttribute name="name"/>
<maxXAttribute name="maxx"/>
<maxYAttribute name="maxy"/>
<minXAttribute name="minx"/>
<minYAttribute name="miny"/>
<resXAttribute name="resx"/>
<resYAttribute name="resy"/>
<tileTableNameAtribute name="tiletable" />
</masterTable>
<tileTable>
<blobAttributeName name="rast" />
</tileTable>
</mapping>

hope this helps…

Ernest.

-- 
Ernest CHIARELLO  -  [Ernest.Chiarello@anonymised.com](mailto:Ernest.Chiarello@anonymised.com)
UMR6049 ThéMA - Théoriser et Modiliser pour Aménager
CNRS / université de Bourgogne Franche-Comté
32 rue Mégevand 25030 BESANÇON Cedex
 
Tel : 03 81 66 54 80           Mob : 07 82 99 11 08
 
 

Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140


Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

DI Christian Mueller MSc (GIS), MSc (IT-Security)

OSS Open Source Solutions GmbH


-- 
Ernest CHIARELLO  -  [Ernest.Chiarello@anonymised.com](mailto:Ernest.Chiarello@anonymised.com)

UMR6049 ThéMA - Théoriser et Modéliser pour Aménager
CNRS / université de Bourgogne Franche-Comté
32 rue Mégevand 25030 BESANÇON Cedex

Tel : 03 81 66 54 80           Mob : 07 82 99 11 08

DI Christian Mueller MSc (GIS), MSc (IT-Security)
OSS Open Source Solutions GmbH