[GIS] WFS save problem, ‘read-only’ exception

geoserveropenlayers-2wfs

I am trying to save changes via WFS-T using GeoServer:

var editLayer = new OpenLayers.Layer.Vector("Edit Layer", {
        visibility: false,
        strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
        rendererOptions: { zIndexing: true },
        projection: new OpenLayers.Projection("EPSG:900913"),
        protocol: new OpenLayers.Protocol.WFS({
            srsName: "EPSG:900913",
            url: URL,
            featureType: "SETTLEMENTS",
            featureNS: NS,
            featurePrefix: Prefix,
            geometryName: "GEOM",
            version: "1.1.0"
        }),
        eventListeners: ...

But the server returns error:

<?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport version="1.0.0"
  xsi:schemaLocation="http://www.opengis.net/ows http://../geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ows="http://www.opengis.net/ows">
  <ows:Exception exceptionCode="NoApplicableCode">
    <ows:ExceptionText>{http://...}SETTLEMENTS is read-only</ows:ExceptionText>
  </ows:Exception>
</ows:ExceptionReport>

Why is the feature readonly and how to fix it?

Best Answer

The most likely problem is that the user that is running GeoServer doesn't have write permission to the table (or one of the support metadata tables). If you are running inside Tomcat then there is (or should be) a tomcat user running the process who will almost certainly not have write permissions to the tables.