[API-users] download request for with predicate in taxon_keys throws exception

Markus Döring mdoering at gbif.org
Sat Jul 19 12:31:53 CEST 2014


Thanks Jorrit,

this is indeed a bug in our download code that is unable to handle the taxonKey, coordinate or boundingbox parameters with the IN predicate.
Ive opened an issue here: http://dev.gbif.org/issues/browse/POR-2328

As a quick solution I recommend to construct an OR query instead:

—— filter.json
{
  "creator":"USERNAME",
  "notification_address": ["EMAIL"],
  "predicate":
  {
    "type":"or",
    "predicates": [
	{"type":"equals","key":"TAXON_KEY","value":"2440447"},
	{"type":"equals","key":"TAXON_KEY","value":"5166399"},
	{"type":"equals","key":"TAXON_KEY","value":"2269484"}
    ]
  }
}
——


best,
Markus




On 18 Jul 2014, at 22:23, jorrit poelen <jhpoelen at xs4all.nl> wrote:

> Hi!
> 
> When using:
> curl -i --user USER:PASSWORD -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d @filter.json http://api.gbif.org/v1/occurrence/download/request
> 
> with 
> —— filter.json
> {
>  "creator”:”USERNAME",
>  "notification_address": [“EMAIL"],
>  "predicate":
>  {
>    "type":"in",
> 	"key":"TAXON_KEY",
>    "values":["2440447","5166399", "2269484"] 
>  }
> }
> ——
> 
> I am getting a 500 status (see stack trace below). Am I using a valid predicate?
> 
> thx,
> -jorrit
> 
> http://globalbioticinteractions.org
> 
> — stacktrace —
> HTTP/1.1 500 Internal Server Error
> Server: Apache-Coyote/1.1
> Content-Type: text/html;charset=utf-8
> x-api-url: /v1/occurrence/download/request
> Transfer-Encoding: chunked
> Date: Fri, 18 Jul 2014 20:21:20 GMT
> X-Varnish: 626777577
> Age: 0
> Via: 1.1 varnish
> Connection: keep-alive
> 
> <html><head><title>Apache Tomcat/7.0.39 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - Error building the hive query, attempting to continue</h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u>Error building the hive query, attempting to continue</u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>org.gbif.api.exception.ServiceUnavailableException: Error building the hive query, attempting to continue
> 	org.gbif.occurrence.download.service.DownloadRequestServiceImpl.create(DownloadRequestServiceImpl.java:207)
> 	org.gbif.occurrence.ws.resources.DownloadResource.startDownload(DownloadResource.java:107)
> 	org.apache.bval.guice.ValidateMethodInterceptor.invoke(ValidateMethodInterceptor.java:92)
> 	sun.reflect.GeneratedMethodAccessor2784.invoke(Unknown Source)
> 	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	java.lang.reflect.Method.invoke(Method.java:606)
> 	com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
> 	com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
> 	com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
> 	com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
> 	com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
> 	com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
> 	com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
> 	com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1483)
> 	com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1414)
> 	com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1363)
> 	com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1353)
> 	com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:414)
> 	com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
> 	com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
> 	com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263)
> 	com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178)
> 	com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
> 	com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)
> 	com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
> 	com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
> </pre></p><p><b>root cause</b> <pre>org.gbif.occurrence.download.service.QueryBuildingException: java.lang.reflect.InvocationTargetException
> 	org.gbif.occurrence.download.service.HiveQueryVisitor.visit(HiveQueryVisitor.java:355)
> 	org.gbif.occurrence.download.service.HiveQueryVisitor.getHiveQuery(HiveQueryVisitor.java:151)
> 	org.gbif.occurrence.download.service.DownloadRequestServiceImpl.create(DownloadRequestServiceImpl.java:204)
> 	org.gbif.occurrence.ws.resources.DownloadResource.startDownload(DownloadResource.java:107)
> 	org.apache.bval.guice.ValidateMethodInterceptor.invoke(ValidateMethodInterceptor.java:92)
> 	sun.reflect.GeneratedMethodAccessor2784.invoke(Unknown Source)
> 	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	java.lang.reflect.Method.invoke(Method.java:606)
> 	com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
> 	com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
> 	com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
> 	com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
> 	com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
> 	com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
> 	com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
> 	com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1483)
> 	com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1414)
> 	com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1363)
> 	com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1353)
> 	com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:414)
> 	com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
> 	com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
> 	com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263)
> 	com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178)
> 	com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
> 	com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)
> 	com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
> 	com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
> </pre></p><p><b>root cause</b> <pre>java.lang.reflect.InvocationTargetException
> 	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	java.lang.reflect.Method.invoke(Method.java:606)
> 	org.gbif.occurrence.download.service.HiveQueryVisitor.visit(HiveQueryVisitor.java:348)
> 	org.gbif.occurrence.download.service.HiveQueryVisitor.getHiveQuery(HiveQueryVisitor.java:151)
> 	org.gbif.occurrence.download.service.DownloadRequestServiceImpl.create(DownloadRequestServiceImpl.java:204)
> 	org.gbif.occurrence.ws.resources.DownloadResource.startDownload(DownloadResource.java:107)
> 	org.apache.bval.guice.ValidateMethodInterceptor.invoke(ValidateMethodInterceptor.java:92)
> 	sun.reflect.GeneratedMethodAccessor2784.invoke(Unknown Source)
> 	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	java.lang.reflect.Method.invoke(Method.java:606)
> 	com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
> 	com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
> 	com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
> 	com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
> 	com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
> 	com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
> 	com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
> 	com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1483)
> 	com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1414)
> 	com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1363)
> 	com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1353)
> 	com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:414)
> 	com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
> 	com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
> 	com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263)
> 	com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178)
> 	com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
> 	com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)
> 	com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
> 	com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
> </pre></p><p><b>root cause</b> <pre>java.lang.IllegalArgumentException: Search parameter TAXON_KEY is not mapped to Hive
> 	org.gbif.occurrence.download.service.HiveQueryVisitor.toHiveField(HiveQueryVisitor.java:137)
> 	org.gbif.occurrence.download.service.HiveQueryVisitor.visit(HiveQueryVisitor.java:199)
> 	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	java.lang.reflect.Method.invoke(Method.java:606)
> 	org.gbif.occurrence.download.service.HiveQueryVisitor.visit(HiveQueryVisitor.java:348)
> 	org.gbif.occurrence.download.service.HiveQueryVisitor.getHiveQuery(HiveQueryVisitor.java:151)
> 	org.gbif.occurrence.download.service.DownloadRequestServiceImpl.create(DownloadRequestServiceImpl.java:204)
> 	org.gbif.occurrence.ws.resources.DownloadResource.startDownload(DownloadResource.java:107)
> 	org.apache.bval.guice.ValidateMethodInterceptor.invoke(ValidateMethodInterceptor.java:92)
> 	sun.reflect.GeneratedMethodAccessor2784.invoke(Unknown Source)
> 	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	java.lang.reflect.Method.invoke(Method.java:606)
> 	com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
> 	com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
> 	com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
> 	com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
> 	com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
> 	com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
> 	com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
> 	com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1483)
> 	com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1414)
> 	com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1363)
> 	com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1353)
> 	com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:414)
> 	com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
> 	com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
> 	com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263)
> 	com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178)
> 	com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
> 	com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)
> 	com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
> 	com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
> </pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/7.0.39 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.39</h3></body></html>
> ----
> 
> _______________________________________________
> API-users mailing list
> API-users at lists.gbif.org
> http://lists.gbif.org/mailman/listinfo/api-users



More information about the API-users mailing list