It seems that when trying to access a secured remote WMS with connection pooling activated, the basic-authentication is not sent. Indeed, while trying to add a Cascaded WMS datastore configured onto a protected WMS, along with a correct basic authentication, I got the following stacktrace server-side:
{code}
24 Mar 14:10:42 INFO [geoserver.web] - Getting list of layers for the WMS store https://protected-wms/mapproxy/service?
java.lang.RuntimeException: Could not list layers for this store, an error occurred retrieving them: null
at org.geoserver.web.data.layer.NewLayerPageProvider.getItemsInternal(NewLayerPageProvider.java:181)
at org.geoserver.web.data.layer.NewLayerPageProvider.getItems(NewLayerPageProvider.java:60)
at org.geoserver.web.wicket.GeoServerDataProvider.getFilteredItems(GeoServerDataProvider.java:190)
at org.geoserver.web.data.layer.NewLayerPageProvider.getFilteredItems(NewLayerPageProvider.java:197)
at org.geoserver.web.wicket.GeoServerDataProvider.size(GeoServerDataProvider.java:208)
at org.geoserver.web.wicket.GeoServerTablePanel$PagerDelegate.updateMatched(GeoServerTablePanel.java:662)
at org.geoserver.web.wicket.GeoServerTablePanel$PagerDelegate.<init>(GeoServerTablePanel.java:657)
at org.geoserver.web.wicket.GeoServerTablePanel.<init>(GeoServerTablePanel.java:236)
at org.geoserver.web.wicket.GeoServerTablePanel.<init>(GeoServerTablePanel.java:105)
at org.geoserver.web.data.layer.NewLayerPage$1.<init>(NewLayerPage.java:111)
at org.geoserver.web.data.layer.NewLayerPage.<init>(NewLayerPage.java:110)
at org.geoserver.web.data.store.WMSStoreNewPage.onSave(WMSStoreNewPage.java:88)
at org.geoserver.web.data.store.AbstractWMSStorePage$2.onSubmit(AbstractWMSStorePage.java:212)
at org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink$1.onSubmit(AjaxSubmitLink.java:111)
[…]
Caused by: java.io.IOException
at org.geoserver.catalog.ResourcePool.getWebMapServer(ResourcePool.java:1869)
at org.geoserver.catalog.impl.WMSStoreInfoImpl.getWebMapServer(WMSStoreInfoImpl.java:104)
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:144)
at com.sun.proxy.$Proxy126.getWebMapServer(Unknown Source)
at org.geoserver.web.data.layer.NewLayerPageProvider.getItemsInternal(NewLayerPageProvider.java:141)
… 138 more
Caused by: org.geotools.ows.ServiceException: Error while parsing XML.
org.xml.sax.SAXParseException; lineNumber: 28; columnNumber: 3; The element type “meta” must be terminated by the matching end-tag “</meta>”.
at org.geotools.ows.wms.response.WMSGetCapabilitiesResponse.<init>(WMSGetCapabilitiesResponse.java:58)
at org.geotools.ows.wms.WMS1_0_0$GetCapsRequest.createResponse(WMS1_0_0.java:230)
at org.geotools.data.ows.AbstractOpenWebService.internalIssueRequest(AbstractOpenWebService.java:461)
at org.geotools.ows.wms.WebMapServer.issueRequest(WebMapServer.java:450)
at org.geotools.data.ows.AbstractOpenWebService.negotiateVersion(AbstractOpenWebService.java:287)
at org.geotools.data.ows.AbstractOpenWebService.<init>(AbstractOpenWebService.java:124)
at org.geotools.data.ows.AbstractOpenWebService.<init>(AbstractOpenWebService.java:97)
at org.geotools.ows.wms.WebMapServer.<init>(WebMapServer.java:405)
at org.geoserver.catalog.ResourcePool.createWebMapServer(ResourcePool.java:1886)
at org.geoserver.catalog.ResourcePool.getWebMapServer(ResourcePool.java:1857)
… 146 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 28; columnNumber: 3; The element type “meta” must be terminated by the matching end-tag “</meta>”.
at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204)
at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:178)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1465)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1685)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2883)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216)
at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635)
at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:324)
at java.xml/javax.xml.parsers.SAXParser.parse(SAXParser.java:197)
at org.geotools.xml.DocumentFactory.getInstance(DocumentFactory.java:128)
at org.geotools.ows.wms.response.WMSGetCapabilitiesResponse.<init>(WMSGetCapabilitiesResponse.java:56)
… 155 more
{code}
I suspect the stacktrace to appear when GeoTools tries to parse a HTML page, being redirected onto the login page of the remote system, after a failing connection attempt.
If I deactivate the connection pooling when creating the datastore, I don’t encounter the issue, and I am able to publish a cascaded layer afterwards.
Using a publicly available remote WMS, I can create cascaded layers, no matter whether the connection pooling is activated or not.
|