0

I have used the geoserver REST API to Create Workspace/Namespace ->> the Create datastore (Postgis) and now trying to publish a layer via REST still.

I get an error when I try to publish the Postgis datastore tables.

Note: the layer name is appended at the end of the Namespace URI. Why would that be so? Example XML tat I'm posting to the REST endpoint for featureTypes is this

endpoint: http://geoserverhost:8180/geoserver/rest/workspaces/[workspace]/datastores/[datastore]/featuretypes

<featureType>
  <name>rivers</name>
  <nativeName>rivers</nativeName>
  <title> rivers </title>
  <srs>EPSG:4326</srs>
  <enabled>true</enabled>
  <namespace>
    <name>[workspaceName]</name>
  </namespace>
  <namespaceName>[namespaccePrefix]</namespaceName>
</featureType>

Here is the Geoserver Stack trace

2018-07-03 11:57:49,919 ERROR [geoserver.rest] - Schema 'http://www.host.co.ke/[prefix]:rivers' does not exist.
java.io.IOException: Schema 'http://www.host.co.ke/[prefix]:rivers' does not exist.
        at org.geotools.data.store.ContentDataStore.ensureEntry(ContentDataStore.java:620)
        at org.geotools.data.store.ContentDataStore.getFeatureSource(ContentDataStore.java:393)
        at org.geotools.data.store.ContentDataStore.getFeatureSource(ContentDataStore.java:686)
        at org.geoserver.catalog.ResourcePool.getFeatureSource(ResourcePool.java:1267)
        at org.geoserver.catalog.impl.FeatureTypeInfoImpl.getFeatureSource(FeatureTypeInfoImpl.java:126)
        at org.geoserver.catalog.CatalogBuilder.getNativeBounds(CatalogBuilder.java:608)
        at org.geoserver.catalog.CatalogBuilder.doSetupBounds(CatalogBuilder.java:508)
        at org.geoserver.catalog.CatalogBuilder.setupBounds(CatalogBuilder.java:497)
        at org.geoserver.catalog.CatalogBuilder.initFeatureType(CatalogBuilder.java:755)
        at org.geoserver.rest.catalog.FeatureTypeController.featureTypePost(FeatureTypeController.java:219)
        at sun.reflect.GeneratedMethodAccessor554.invoke(Unknown Source)

//What solves my problem is a problem to me as well

This Stackexchange question Geoserver gives "schema does not exist" after creation using REST interface led me to try out opening the workspace from the Geoserver Admin UI and clicking SAVE again.

And this seems to do away with the problem. But I think this is not sustainable for me.

What is likely to be the problem, any proposals on how to deal with this.

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.