core-geonetwork icon indicating copy to clipboard operation
core-geonetwork copied to clipboard

Error in CSW GetRecords when boundingbox with urn:ogc:def:crs:OGC:1.3:CRS84 srsName is used

Open juanluisrp opened this issue 5 years ago • 1 comments

Describe the bug A CSW request using a BBOX filter with srsName=urn:ogc:def:crs:OGC:1.3:CRS84 returns this error:

Error is: java.lang.RuntimeException: Parsing failed for Envelope: java.lang.RuntimeException: Could not create crs: urn:ogc:def:crs:OGC:1.3:CRS84

To Reproduce Steps to reproduce the behavior:

  1. Go to Test CSW utility in Admin Console -> Settings -> CSW test and paste this request:
<?xml version="1.0"?>

<csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2"
                service="CSW" version="2.0.2">
  <csw:Query typeNames="csw:Record">
    <csw:Constraint version="1.1.0">
      <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
  <ogc:BBOX>
    <ogc:PropertyName>ows:BoundingBox</ogc:PropertyName>
    <gml311:Envelope xmlns:gml311="http://www.opengis.net/gml" srsName="urn:ogc:def:crs:OGC:1.3:CRS84">
      <gml311:lowerCorner>-23 -90</gml311:lowerCorner>
      <gml311:upperCorner>23 90</gml311:upperCorner>
    </gml311:Envelope>
  </ogc:BBOX>
</ogc:Filter>
    </csw:Constraint>
  </csw:Query>
</csw:GetRecords>
  1. Click on Send CSW request button
  2. See error in the response:
<?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2.0" xsi:schemaLocation="http://www.opengis.net/ows http://schemas.opengis.net/ows/1.0.0/owsExceptionReport.xsd">
  <ows:Exception exceptionCode="NoApplicableCode">
    <ows:ExceptionText>Raised exception while searching metadata : java.lang.IllegalArgumentException: Error when parsing spatial filter (version: 1.1.0):&lt;ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"&gt;&#xD;
  &lt;ogc:BBOX&gt;&#xD;
    &lt;ogc:PropertyName&gt;ows:BoundingBox&lt;/ogc:PropertyName&gt;&#xD;
    &lt;gml311:Envelope xmlns:gml311="http://www.opengis.net/gml" srsName="urn:ogc:def:crs:OGC:1.3:CRS84"&gt;&#xD;
      &lt;gml311:lowerCorner&gt;-23 -90&lt;/gml311:lowerCorner&gt;&#xD;
      &lt;gml311:upperCorner&gt;23 90&lt;/gml311:upperCorner&gt;&#xD;
    &lt;/gml311:Envelope&gt;&#xD;
  &lt;/ogc:BBOX&gt;&#xD;
&lt;/ogc:Filter&gt;. Error is: java.lang.RuntimeException: Parsing failed for Envelope: java.lang.RuntimeException: Could not create crs: urn:ogc:def:crs:OGC:1.3:CRS84</ows:ExceptionText>
  </ows:Exception>
</ows:ExceptionReport>

Expected behavior There is no error decoding the CRS string and the request is executed.

Log file Stacktrace is

2019-10-02 10:46:51,938 ERROR [geonetwork.csw.search] - Error while searching metadata
2019-10-02 10:46:51,939 ERROR [geonetwork.csw.search] -   (C) StackTrace:
java.lang.IllegalArgumentException: Error when parsing spatial filter (version: 1.1.0):<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
  <ogc:BBOX>
    <ogc:PropertyName>ows:BoundingBox</ogc:PropertyName>
    <gml311:Envelope xmlns:gml311="http://www.opengis.net/gml" srsName="urn:ogc:def:crs:OGC:1.3:CRS84">
      <gml311:lowerCorner>-23 -90</gml311:lowerCorner>
      <gml311:upperCorner>23 90</gml311:upperCorner>
    </gml311:Envelope>
  </ogc:BBOX>
</ogc:Filter>. Error is: java.lang.RuntimeException: Parsing failed for Envelope: java.lang.RuntimeException: Could not create crs: urn:ogc:def:crs:OGC:1.3:CRS84
	at org.fao.geonet.kernel.search.SearchManager$Spatial.filter(SearchManager.java:1657)
	at org.fao.geonet.kernel.csw.services.getrecords.CatalogSearcher.performSearch(CatalogSearcher.java:524)
	at org.fao.geonet.kernel.csw.services.getrecords.CatalogSearcher.search(CatalogSearcher.java:222)
	at org.fao.geonet.kernel.csw.services.getrecords.SearchController.search(SearchController.java:431)
	at org.fao.geonet.component.csw.GetRecords.execute(GetRecords.java:263)
	at org.fao.geonet.component.csw.CatalogDispatcher.dispatchI(CatalogDispatcher.java:141)
	at org.fao.geonet.component.csw.CatalogDispatcher.dispatch(CatalogDispatcher.java:99)
	at org.fao.geonet.services.main.CswDiscoveryDispatcher.exec(CswDiscoveryDispatcher.java:114)
	at jeeves.server.dispatchers.ServiceInfo.execService(ServiceInfo.java:227)
	at jeeves.server.dispatchers.ServiceInfo.noTransactionExec(ServiceInfo.java:142)
	at jeeves.server.dispatchers.ServiceInfo.access$000(ServiceInfo.java:46)
	at jeeves.server.dispatchers.ServiceInfo$1.doInTransaction(ServiceInfo.java:121)
	at jeeves.server.dispatchers.ServiceInfo$1.doInTransaction(ServiceInfo.java:118)
	at jeeves.transaction.TransactionManager.runInTransaction(TransactionManager.java:73)
	at jeeves.server.dispatchers.ServiceInfo.execServices(ServiceInfo.java:115)
	at jeeves.server.dispatchers.ServiceManager.dispatch(ServiceManager.java:449)
	at jeeves.server.dispatchers.ServiceManager.dispatch(ServiceManager.java:387)
	at jeeves.server.JeevesEngine.dispatch(JeevesEngine.java:593)
	at org.fao.geonet.services.main.GenericController.dispatch(GenericController.java:160)
	at sun.reflect.GeneratedMethodAccessor355.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:832)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:743)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:961)
	at jeeves.config.springutil.JeevesDispatcherServlet.access$101(JeevesDispatcherServlet.java:44)
	at jeeves.config.springutil.JeevesDispatcherServlet$1.doInTransaction(JeevesDispatcherServlet.java:56)
	at jeeves.config.springutil.JeevesDispatcherServlet$1.doInTransaction(JeevesDispatcherServlet.java:52)
	at jeeves.transaction.TransactionManager.runInTransaction(TransactionManager.java:73)
	at jeeves.config.springutil.JeevesDispatcherServlet.doDispatch(JeevesDispatcherServlet.java:49)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:895)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.fao.geonet.web.CORSResponseFilter.doFilter(CORSResponseFilter.java:126)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.fao.geonet.monitor.webapp.WebappMetricsFilter.doFilter(WebappMetricsFilter.java:121)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.fao.geonet.monitor.webapp.MetricsRegistryInitializerFilter.doFilter(MetricsRegistryInitializerFilter.java:58)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.fao.geonet.web.XFrameOptionsFilter.doFilter(XFrameOptionsFilter.java:110)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
	at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
	at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
	at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.geonetwork.http.SessionTimeoutCookieFilter.doFilter(SessionTimeoutCookieFilter.java:91)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at jeeves.config.springutil.PassthroughFilter.doFilter(PassthroughFilter.java:50)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:85)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
	at jeeves.config.springutil.JeevesDelegatingFilterProxy.doFilter(JeevesDelegatingFilterProxy.java:104)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)

Desktop (please complete the following information):

  • GeoNetwork Version 3.6.x, 3.8.x, master

Additional context

Problem is caused by GeoTools 16 used in these GN versions not being able of decoding urn:ogc:def:crs:OGC:1.3:CRS84 CRS string. See issue GEOT-1710 in GeoTools issue tracker. The problem has been fixed in GeoTools 17.1 release so updating GT to this version or greater should fix the problem.

juanluisrp avatar Oct 02 '19 10:10 juanluisrp

Could be fixed if #3886 is merged.

juanluisrp avatar Oct 02 '19 10:10 juanluisrp