0

We are calling our own GeoServer WMS with GetMap requests using POST and SLD_BODY. The XML-content looks something like the below example. This gives us a bakground map with our own features overlayed onto it.

enter image description here

We are currently using GeoServer 2.15.5 and it works fine. In versions after 2.15.5 there seems like something has changed as we get the error "couldn't find style named ''" for the named layer.

However we can get map images for the namedlayer if we not use SLD_BODY but LAYERS instead.

The named background layer comes from a cascaded WMS and and we have also noticed an error opening the layer in the GeoServer UI "Couldn't fetch remote styles". In version 2.15.5 we don't get this error and the default "raster" style is used (working just fine).

21 Apr 10:04:34 ERROR [catalog.impl] - Unable to fetch available styles for cascaded layer topowebbkartan 21 Apr 10:04:34 ERROR [catalog.impl] - Index 0 out of bounds for length 0 java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0 at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248) at java.base/java.util.Objects.checkIndex(Objects.java:372) at java.base/java.util.ArrayList.get(ArrayList.java:459) at org.geoserver.catalog.impl.WMSLayerInfoImpl.getStyleInfo(WMSLayerInfoImpl.java:236) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) at org.geoserver.catalog.impl.WMSLayerInfoImpl.getRemoteStyleInfos(WMSLayerInfoImpl.java:195) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.geoserver.catalog.impl.ModificationProxy.invoke(ModificationProxy.java:94) at com.sun.proxy.$Proxy631.getRemoteStyleInfos(Unknown Source) at org.geoserver.wms.web.publish.WMSLayerConfig.initWMSCascadedUI(WMSLayerConfig.java:210) at org.geoserver.wms.web.publish.WMSLayerConfig.(WMSLayerConfig.java:153) at jdk.internal.reflect.GeneratedConstructorAccessor819.newInstance(Unknown Source) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at org.geoserver.web.publish.PublishedConfigurationPage$PublishingEditTabPanel$1.populateItem(PublishedConfigurationPage.java:447) at org.apache.wicket.markup.html.list.ListView.onPopulate(ListView.java:523) at org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:124) at org.apache.wicket.Component.internalBeforeRender(Component.java:950) at org.apache.wicket.Component.beforeRender(Component.java:1018) at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1826) at org.apache.wicket.Component.onBeforeRender(Component.java:3921) at org.apache.wicket.Component.internalBeforeRender(Component.java:950) at org.apache.wicket.Component.beforeRender(Component.java:1018) at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1826) at org.apache.wicket.Component.onBeforeRender(Component.java:3921) at org.apache.wicket.extensions.markup.html.tabs.TabbedPanel.onBeforeRender(TabbedPanel.java:274) at org.apache.wicket.Component.internalBeforeRender(Component.java:950) at org.apache.wicket.Component.beforeRender(Component.java:1018) at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1826) at org.apache.wicket.Component.onBeforeRender(Component.java:3921) at org.apache.wicket.markup.html.form.Form.onBeforeRender(Form.java:1816) at org.apache.wicket.Component.internalBeforeRender(Component.java:950) at org.apache.wicket.Component.beforeRender(Component.java:1018) at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1826) at org.apache.wicket.Component.onBeforeRender(Component.java:3921) at org.apache.wicket.Page.onBeforeRender(Page.java:801) at org.apache.wicket.Component.internalBeforeRender(Component.java:950) at org.apache.wicket.Component.beforeRender(Component.java:1018) at org.apache.wicket.Component.internalPrepareForRender(Component.java:2236) at org.apache.wicket.Page.internalPrepareForRender(Page.java:242) at org.apache.wicket.Component.render(Component.java:2327) at org.apache.wicket.Page.renderPage(Page.java:1018) at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:124) at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:236) at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175) at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:895) at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:97) at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293) at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261) at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:203) at org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:159) at javax.servlet.http.HttpServlet.service(HttpServlet.java:528) at javax.servlet.http.HttpServlet.service(HttpServlet.java:596) at org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:166) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:52) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1043) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) at javax.servlet.http.HttpServlet.service(HttpServlet.java:528) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) at javax.servlet.http.HttpServlet.service(HttpServlet.java:596) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) at org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:28) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:73) at org.geoserver.ows.HTTPHeadersCollector.doFilter(HTTPHeadersCollector.java:48) at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:70) at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:194) at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:70) at org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:43) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) at org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:39) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320) at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:71) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:75) at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:92) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:71) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119) at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:75) at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:92) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.geoserver.security.filter.GeoServerAnonymousAuthenticationFilter.doFilter(GeoServerAnonymousAuthenticationFilter.java:53) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:71) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:75) at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:92) at org.geoserver.security.filter.GeoServerUserNamePasswordAuthenticationFilter.doFilter(GeoServerUserNamePasswordAuthenticationFilter.java:122) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:71) at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:158) at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:75) at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:92) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:71) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) at org.geoserver.security.filter.GeoServerSecurityContextPersistenceFilter$1.doFilter(GeoServerSecurityContextPersistenceFilter.java:52) at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:75) at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:92) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) at org.geoserver.security.GeoServerSecurityFilterChainProxy.doFilter(GeoServerSecurityFilterChainProxy.java:142) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) at org.geoserver.filters.XFrameOptionsFilter.doFilter(XFrameOptionsFilter.java:77) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:48) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) at org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:49) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) at org.geoserver.filters.FlushSafeFilter.doFilter(FlushSafeFilter.java:42) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:492) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:673) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:389) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:926) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1791) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Thread.java:834) 21 Apr 10:04:34 ERROR [web.publish] - null:unable to fetch remote styles for topowebbkartan java.lang.reflect.UndeclaredThrowableException at com.sun.proxy.$Proxy631.getRemoteStyleInfos(Unknown Source) at org.geoserver.wms.web.publish.WMSLayerConfig.initWMSCascadedUI(WMSLayerConfig.java:210) at org.geoserver.wms.web.publish.WMSLayerConfig.(WMSLayerConfig.java:153) at jdk.internal.reflect.GeneratedConstructorAccessor819.newInstance(Unknown Source) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at org.geoserver.web.publish.PublishedConfigurationPage$PublishingEditTabPanel$1.populateItem(PublishedConfigurationPage.java:447) at org.apache.wicket.markup.html.list.ListView.onPopulate(ListView.java:523) at org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:124) at org.apache.wicket.Component.internalBeforeRender(Component.java:950) at org.apache.wicket.Component.beforeRender(Component.java:1018) at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1826) at org.apache.wicket.Component.onBeforeRender(Component.java:3921) at org.apache.wicket.Component.internalBeforeRender(Component.java:950) at org.apache.wicket.Component.beforeRender(Component.java:1018) at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1826) at org.apache.wicket.Component.onBeforeRender(Component.java:3921) at org.apache.wicket.extensions.markup.html.tabs.TabbedPanel.onBeforeRender(TabbedPanel.java:274) at org.apache.wicket.Component.internalBeforeRender(Component.java:950) at org.apache.wicket.Component.beforeRender(Component.java:1018) at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1826) at org.apache.wicket.Component.onBeforeRender(Component.java:3921)

2
  • Can you add to the description the full stack trace related to that "Couldn't fetch remote styles" error? Or can you share the WMS server capabilities link? Commented Apr 20, 2023 at 6:49
  • Hi! Added trace above what happens when editing the layer.
    – user223210
    Commented Apr 21, 2023 at 9:03

1 Answer 1

2

Recent versions of GeoServer are more strict when it comes to using virtual services. In particular, if you are posting to the global service, then you should be using the full layer name, "workspace:layer", but if you are using a workspace specific service (AKA virtual service) then the layer name should be simply "layer".

To avoid confusion, here are sample URLs:

  • Global service, http://host:port/geoserver/ows?...
  • Workspace specific service, http://port/geoserver/workspace/ows?...

In addition to that, rencet versions of GeoServer require the remote server to have a LegendURL entry, which the server you're cascading is not providing. Since it's not actually required by the spec, the issue is in GeoServer. You can report the issue here and read this guide if you need a fix quickly.

1
  • Hi, thank you for the answer. We have tried both with and without workspace, but no success unfortunatly.
    – user223210
    Commented Apr 19, 2023 at 13:03

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.