2

Getting started with Geoserver (version 2.10.2) I run into the following problem. Using the REST interface I create a workspace, a datastore and a featuretype. They show up in the Geoserver web interface and have the exact same properties as the manually created workspace, datastore and featuretype I've used as an example earlier.

However, Layer preview gives an error:

Schema <my_schema> does not exist.

To fix this all I have to do is go to Workspaces, select my workspace and press save. Now the layer preview works.

Is this a bug or am I missing a step using the REST interface?

Called from Oracle

Workspace:

l_clob    := apex_web_service.make_rest_request(p_url         => 'localhost:8888/geoserver/rest/workspaces'
                                                     ,p_http_method => 'POST'
                                                     ,p_body        => l_content
                                                     ,p_username    => 'admin'
                                                     ,p_password    => 'geoserver');



 <workspace><name>' || p_workspace || '</name></workspace>

Datastore:

URL: 'localhost:8888/geoserver/rest/workspaces/' || p_workspace_name || '/datastores'

<dataStore>
                          <name>' || p_workspace_name ||
                   '</name>
                          <description>' || p_workspace_name ||
                   '</description>
                          <type>Oracle NG</type>
                          <enabled>true</enabled>
                          <workspace>
                            <name>' || p_workspace_name ||
                   '</name>
                          </workspace>
                          <connectionParameters>
                            <entry key="schema">' || p_schema ||
                   '</entry>
                            <entry key="Evictor run periodicity">300</entry>
                            <entry key="Max open prepared statements">50</entry>
                            <entry key="Batch insert size">1</entry>
                            <entry key="Metadata bbox">false</entry>
                            <entry key="database">' || g_database ||
                   '</entry>
                            <entry key="host">localhost</entry>
                            <entry key="Loose bbox">true</entry>
                            <entry key="Estimated extends">true</entry>
                            <entry key="fetch size">1000</entry>
                            <entry key="Expose primary keys">true</entry>
                            <entry key="validate connections">true</entry>
                            <entry key="Connection timeout">20</entry>
                            <entry key="port">1521</entry>
                            <entry key="passwd">' || g_password ||
                   '</entry>
                            <entry key="min connections">1</entry>
                            <entry key="dbtype">oracle</entry>
                            <entry key="namespace">' || p_workspace_name ||
                   '</entry>
                            <entry key="max connections">10</entry>
                            <entry key="Evictor tests per run">3</entry>
                            <entry key="Test while idle">true</entry>
                            <entry key="user">' || p_schema ||
                   '</entry>
                            <entry key="Max connection idle time">300</entry>
                          </connectionParameters>
                      </dataStore>

Featuretype:

URL: localhost:8888/geoserver/rest/workspaces/' ||p_workspace_name || /datastores/' || p_workspace_name || '/featuretypes/'

<featureType>
  <name>' || p_tabel || '</name>
  <nativeName>' || p_tabel || '</nativeName>
  <namespace>
    <name>' || p_workspace_name ||
                   '</name>
    <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8888/geoserver/rest/namespaces/' ||
                   p_workspace_name || '.xml" type="application/xml"/>
  </namespace>
  <title>' || p_tabel || '</title>
  <keywords>
    <string>features</string>
    <string>' || p_tabel || '</string>
  </keywords>
  <nativeCRS class="projected">PROJCS["Amersfoort / RD New", 
  GEOGCS["Amersfoort", 
    DATUM["Amersfoort", 
      SPHEROID["Bessel 1841", 6377397.155, 299.1528128, AUTHORITY["EPSG","7004"]], 
      TOWGS84[565.2369, 50.0087, 465.658, -0.40685733032239757, -0.3507326765425626, 1.8703473836067959, 4.0812], 
      AUTHORITY["EPSG","6289"]], 
    PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], 
    UNIT["degree", 0.017453292519943295], 
    AXIS["Geodetic longitude", EAST], 
    AXIS["Geodetic latitude", NORTH], 
    AUTHORITY["EPSG","4289"]], 
  PROJECTION["Oblique_Stereographic", AUTHORITY["EPSG","9809"]], 
  PARAMETER["central_meridian", 5.387638888888891], 
  PARAMETER["latitude_of_origin", 52.15616055555556], 
  PARAMETER["scale_factor", 0.9999079], 
  PARAMETER["false_easting", 155000.0], 
  PARAMETER["false_northing", 463000.0], 
  UNIT["m", 1.0], 
  AXIS["Easting", EAST], 
  AXIS["Northing", NORTH], 
  AUTHORITY["EPSG","28992"]]</nativeCRS>
  <srs>EPSG:28992</srs>
  <nativeBoundingBox>
    <minx>154447.304</minx>
    <maxx>155182.189</maxx>
    <miny>463701.556</miny>
    <maxy>464379.787</maxy>
    <crs class="projected">EPSG:28992</crs>
  </nativeBoundingBox>
  <latLonBoundingBox>
    <minx>5.380187362904969</minx>
    <maxx>5.390928960588461</maxx>
    <miny>52.161671257245374</miny>
    <maxy>52.16776740102754</maxy>
    <crs>GEOGCS["WGS84(DD)", 
  DATUM["WGS84", 
    SPHEROID["WGS84", 6378137.0, 298.257223563]], 
  PRIMEM["Greenwich", 0.0], 
  UNIT["degree", 0.017453292519943295], 
  AXIS["Geodetic longitude", EAST], 
  AXIS["Geodetic latitude", NORTH]]</crs>
  </latLonBoundingBox>
  <projectionPolicy>FORCE_DECLARED</projectionPolicy>
  <enabled>true</enabled>
  <metadata>
    <entry key="cachingEnabled">false</entry>
  </metadata>
  <store class="dataStore">
    <name>' || p_workspace_name || ':' || p_workspace_name ||
                   '</name>
    <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8888/geoserver/rest/workspaces/' ||
                   p_workspace_name || '/datastores/' || p_workspace_name || '.xml" type="application/xml"/>
  </store>
  <maxFeatures>0</maxFeatures>
  <numDecimals>0</numDecimals>
  <overridingServiceSRS>false</overridingServiceSRS>
  <skipNumberMatched>false</skipNumberMatched>
  <circularArcPresent>false</circularArcPresent>
  <attributes>
    <attribute>
      <name>ID</name>
      <minOccurs>1</minOccurs>
      <maxOccurs>1</maxOccurs>
      <nillable>false</nillable>
      <binding>java.math.BigDecimal</binding>
    </attribute>
    <attribute>
      <name>DATA</name>
      <minOccurs>0</minOccurs>
      <maxOccurs>1</maxOccurs>
      <nillable>true</nillable>
      <binding>java.lang.String</binding>
    </attribute>
    <attribute>
      <name>GEOMETRIE</name>
      <minOccurs>0</minOccurs>
      <maxOccurs>1</maxOccurs>
      <nillable>true</nillable>
      <binding>com.vividsolutions.jts.geom.Geometry</binding>
    </attribute>
    <attribute>
      <name>TRE_ID_V</name>
      <minOccurs>0</minOccurs>
      <maxOccurs>1</maxOccurs>
      <nillable>true</nillable>
      <binding>java.math.BigDecimal</binding>
    </attribute>
    <attribute>
      <name>TRE_ID_O</name>
      <minOccurs>1</minOccurs>
      <maxOccurs>1</maxOccurs>
      <nillable>false</nillable>
      <binding>java.math.BigDecimal</binding>
    </attribute>
    <attribute>
      <name>REF_OGD_ID</name>
      <minOccurs>0</minOccurs>
      <maxOccurs>1</maxOccurs>
      <nillable>true</nillable>
      <binding>java.math.BigDecimal</binding>
    </attribute>
    <attribute>
      <name>REF_CLF_IDS</name>
      <minOccurs>0</minOccurs>
      <maxOccurs>1</maxOccurs>
      <nillable>true</nillable>
      <binding>java.lang.String</binding>
    </attribute>
    <attribute>
      <name>NAUWKEURIGHEID</name>
      <minOccurs>0</minOccurs>
      <maxOccurs>1</maxOccurs>
      <nillable>true</nillable>
      <binding>java.math.BigDecimal</binding>
    </attribute>
    <attribute>
      <name>NR_INWINNINGSMETHODE</name>
      <minOccurs>0</minOccurs>
      <maxOccurs>1</maxOccurs>
      <nillable>true</nillable>
      <binding>java.math.BigDecimal</binding>
    </attribute>
    <attribute>
      <name>INWINNINGSDATUM</name>
      <minOccurs>0</minOccurs>
      <maxOccurs>1</maxOccurs>
      <nillable>true</nillable>
      <binding>java.sql.Date</binding>
    </attribute>
  </attributes>
</featureType>
1
  • please add what sort of data store and the actual commands you used to the question
    – Ian Turton
    Commented Mar 8, 2017 at 13:33

2 Answers 2

2

Fixed the problem bij comparing the geoserver directory contents before and after I hit the SAVE button on the newly added workspace.

In datastore.xml under the workspace the namespace was changed from

<entry key="namespace">RWE11G2_NGM102</entry> 

to

<entry key="namespace">http://RWE11G2_NGM102</entry>  

I Added http:// to the datastore XML and the layers added using the REST interface are available right away.

2

I know this is an old and already-answered question but it is still at the top of search results when one meet this error message. So, for the sake of documentation, here is what I found.

I also got the same error message when creating a featureType through GeoServer's REST API. I'm running GeoServer 2.19.

In my case, this was due to a too long featureType name. Indeed, at some point GeoServer create a PostGIS table to store the features. The table name is limited to 63 characters (unless you set a different limit in your PostgreSQL conf, but there's a limit anyway). So, if your name is longer than 63 chars, the PostGIS table name will be truncated and will not match GeoServer's layer name anymore. This inconsistency will result in this enigmatic error message.

It was possible for me to truncate the featureType name before sending the data to GeoServer's REST API and so work around this limitation.

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.