I’ve encountered a problem with GeoServer REST in both GeoServer 2.6.2 and 2.5.4 (though not, interestingly, in 2.3.1).
When adding a GeoTIFF with a path accessible to GeoServer, the server replies with:
The specified coverageName resttestdemis not supported
This happens when I use cURL:
curl -X POST -d ‘<coverage><enabled>true</enabled><metadata /><keywords /><metadataLinks /><name>resttestdem</name><title>resttestdem</title><srs>EPSG:4326</srs><projectionPolicy>REPROJECT_TO_DECLARED</projectionPolicy></coverage>’ http://admin:geoserver@anonymised.com:8080/geoserver/rest/workspaces/fake_rfe2/coveragestores/testRESTStoreGeotiff/coverages.xml --header “Content-Type:application/xml”
:The specified coverageName resttestdemis not supported
And also when I use GeoServer Manager:
08:22:15.077 [main] DEBUG httpclient.wire.header - >> “POST /geoserver/rest/workspaces/fake_rfe2/coveragestores/testRESTStoreGeotiff/coverages.xml HTTP/1.1[\r][\n]”
08:22:15.079 [main] DEBUG o.a.c.httpclient.HttpMethodBase - Adding Host request header
08:22:15.079 [main] DEBUG httpclient.wire.header - >> “Authorization: Basic YWRtaW46Z2Vvc2VydmVy[\r][\n]”
08:22:15.079 [main] DEBUG httpclient.wire.header - >> “User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]”
08:22:15.080 [main] DEBUG httpclient.wire.header - >> “Host: localhost:8080[\r][\n]”
08:22:15.080 [main] DEBUG httpclient.wire.header - >> “Content-Length: 213[\r][\n]”
08:22:15.080 [main] DEBUG httpclient.wire.header - >> “Content-Type: text/xml[\r][\n]”
08:22:15.080 [main] DEBUG httpclient.wire.header - >> “[\r][\n]”
08:22:15.081 [main] DEBUG httpclient.wire.content - >> “<coverage><enabled>true</enabled><metadata /><keywords /><metadataLinks /><name>resttestdem</name><title>resttestdem</title><srs>EPSG:4326</srs><projectionPolicy>REPROJECT_TO_DECLARED</projectionPolicy></coverage>”
08:22:15.081 [main] DEBUG o.a.c.h.m.EntityEnclosingMethod - Request body sent
08:22:15.198 [main] DEBUG httpclient.wire.header - << “HTTP/1.1 500 Internal Server Error[\r][\n]”
08:22:15.198 [main] DEBUG httpclient.wire.header - << “HTTP/1.1 500 Internal Server Error[\r][\n]”
08:22:15.198 [main] DEBUG httpclient.wire.header - << “Content-Type: text/plain[\r][\n]”
08:22:15.198 [main] DEBUG httpclient.wire.header - << “Transfer-Encoding: chunked[\r][\n]”
08:22:15.198 [main] DEBUG httpclient.wire.header - << “Server: Jetty(6.1.8)[\r][\n]”
08:22:15.199 [main] DEBUG httpclient.wire.header - << “[\r][\n]”
08:22:15.199 [main] DEBUG httpclient.wire.content - << “3”
08:22:15.199 [main] DEBUG httpclient.wire.content - << “7”
08:22:15.199 [main] DEBUG httpclient.wire.content - << “[\r]”
08:22:15.199 [main] DEBUG httpclient.wire.content - << “[\n]”
08:22:15.199 [main] DEBUG httpclient.wire.content - << “:The specified coverageName resttestdemis not supported”
08:22:15.200 [main] DEBUG httpclient.wire.content - << “[\r]”
08:22:15.200 [main] DEBUG httpclient.wire.content - << “[\n]”
08:22:15.200 [main] DEBUG httpclient.wire.content - << “0”
08:22:15.200 [main] DEBUG httpclient.wire.content - << “[\r]”
08:22:15.200 [main] DEBUG httpclient.wire.content - << “[\n]”
08:22:15.200 [main] DEBUG httpclient.wire.content - << “[\r]”
08:22:15.200 [main] DEBUG httpclient.wire.content - << “[\n]”
08:22:15.200 [main] DEBUG httpclient.wire.header - << “[\r][\n]”
When this happens, the following stacktrace appears in the server log:
Caused by: java.lang.IllegalArgumentException: The specified coverageName resttestdemis not supported
at org.geotools.coverage.grid.io.AbstractGridCoverage2DReader.getCoordinateReferenceSystem(AbstractGridCoverage2DReader.java:820)
at org.geoserver.catalog.CoverageDimensionCustomizerReader.getCoordinateReferenceSystem(CoverageDimensionCustomizerReader.java:317)
at org.geoserver.catalog.SingleGridCoverage2DReader.getCoordinateReferenceSystem(SingleGridCoverage2DReader.java:151)
at org.geoserver.catalog.CatalogBuilder.initCoverage(CatalogBuilder.java:790)
at org.geoserver.catalog.rest.CoverageResource.handleObjectPost(CoverageResource.java:87)
at org.geoserver.rest.ReflectiveResource.handlePost(ReflectiveResource.java:121)
Looking at AbstractGridCoverage2DReader.getCoordinateReferenceSystem:
/**
-
Retrieves the {@link GeneralEnvelope} for this {@link AbstractGridCoverage2DReader}.
*
- @return the {@link GeneralEnvelope}
for this
{@link AbstractGridCoverage2DReader}
.
*/
@Override
public CoordinateReferenceSystem getCoordinateReferenceSystem(String coverageName) {
if (!checkName(coverageName))
{ throw new IllegalArgumentException("The specified coverageName " + coverageName + “is not supported”); }
return crs;
}
It appears that checkName is returning false, which means that coverageName != this.coverageName or coverageName == null.
|