Exception:
Caused by:
java.lang.ClassCastException: com.sun.proxy.$Proxy113 cannot be cast to org.geoserver.catalog.impl.LayerInfoImpl
at org.geoserver.importer.rest.ImportTaskController.updateLayer(ImportTaskController.java:500)
at org.geoserver.importer.rest.ImportTaskController.lambda$layerPut$5(ImportTaskController.java:254)
at org.geoserver.importer.rest.converters.ImportWrapperMessageConverter.writeJSON(ImportWrapperMessageConverter.java:84)
at org.geoserver.importer.rest.converters.ImportWrapperMessageConverter.writeInternal(ImportWrapperMessageConverter.java:66)
at org.geoserver.importer.rest.converters.ImportWrapperMessageConverter.writeInternal(ImportWrapperMessageConverter.java:26)
at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:227)
at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:294)
at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue(RequestResponseBodyMethodProcessor.java:181)
at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:82)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:123)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:893)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:798)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
The script I used (by following the docs):
curl -u admin:geoserver -XPOST -H "Content-type: application/json" -d @test-spatial-import.json "https://$HOSTNAME/geoserver/rest/imports"
curl -u admin:geoserver -F name=test -F filedata=@test-spatial.csv "https://$HOSTNAME/geoserver/rest/imports/0/tasks"
curl -u admin:geoserver -XPUT -H "Content-type: application/json" -d @layerUpdate.json -vvv "https://$HOSTNAME/geoserver/rest/imports/0/tasks/0/layer/"
curl -u admin:geoserver -XPOST -H "Content-type: application/json" -d @toPoint.json -vvv "https://$HOSTNAME/geoserver/rest/imports/0/tasks/0/transforms"
curl -u admin:geoserver -XPOST -vvv "https://$HOSTNAME/geoserver/rest/imports/0"
It should be noted I also had to drop an opencsv-5.1.jar file into my WEB-INF/lib folder after extracting the imports-plugin.
The code in question does seem to indicate this could be a bug:
// @hack workaround OWSUtils bug - trying to copy null collections
// why these are null in the first place is a different question
LayerInfoImpl impl = (LayerInfoImpl) orig.getLayer();
if (impl.getAuthorityURLs() == null) {
impl.setAuthorityURLs(new ArrayList(1));
}
if (impl.getIdentifiers() == null) {
impl.setIdentifiers(new ArrayList(1));
}
// @endhack
|