Issue with Set Job Retries Async (POST) while using dates

Hello,

While trying to use the Set Job Retries Async (POST) REST API, we are getting a NullPointerException. Using campunda-bpm-tomcat-7.14.

Request:
POST http://localhost:8080/engine-rest/job/retries

{
  "retries" : 1,
  "jobQuery": {
    "createTimes":
      [
        {
          "operator": "gt",
          "value": "2012-07-17T17:00:00.000+0200"
        },
        {
          "operator": "lt",
          "value": "2022-07-17T18:00:00.000+0200"
        }
      ]
  }
}

Response:

{
    "type": "NullPointerException",
    "message": null
}

Stack Trace:

ENGINE-REST-HTTP500 java.lang.NullPointerException
at org.camunda.bpm.engine.rest.dto.converter.JacksonAwareStringToTypeConverter.mapToType(JacksonAwareStringToTypeConverter.java:42)
at org.camunda.bpm.engine.rest.dto.converter.DateConverter.convertQueryParameterToType(DateConverter.java:25)
at org.camunda.bpm.engine.rest.dto.runtime.JobQueryDto$ApplyDates.run(JobQueryDto.java:257)
at org.camunda.bpm.engine.rest.dto.runtime.JobQueryDto.applyFilters(JobQueryDto.java:409)
at org.camunda.bpm.engine.rest.dto.runtime.JobQueryDto.applyFilters(JobQueryDto.java:47)
at org.camunda.bpm.engine.rest.dto.AbstractQueryDto.toQuery(AbstractQueryDto.java:104)
at org.camunda.bpm.engine.rest.impl.JobRestServiceImpl.setRetries(JobRestServiceImpl.java:113)
at jdk.internal.reflect.GeneratedMethodAccessor1140.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:138)
at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:526)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:415)
at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$0(ResourceMethodInvoker.java:376)
at org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:356)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:378)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:347)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:150)
at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:104)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:440)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:229)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:135)
at org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:356)
at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:138)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:215)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:227)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
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:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.camunda.bpm.engine.rest.filter.CacheControlFilter.doFilter(CacheControlFilter.java:45)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.camunda.bpm.engine.rest.filter.EmptyBodyFilter.doFilter(EmptyBodyFilter.java:99)
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:202)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)
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:373)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:834)

The API works fine when createTimes or dueDates are not provided in jobQuery. Is it something we’re doing wrong while calling this? (we also copied the request examples in the docs and those didn’t work either).

One more note, the get jobs POST method works fine with createTimes.

EDIT:
Seems get jobs POST doesn’t work with more than 1 object in createTimes.

The following request returns an empty array:

{
    "active": true,
    "withException": true,
    "createTimes": [
        {
            "operator": "gt",
            "value": "2021-12-01T01:00:00.000+0200"
        },
        {
            "operator": "lt",
            "value": "2022-12-10T01:00:00.000+0200"
        }
    ]
}

If either of the entries from createTimes is removed, we get an object returned inside the array.

{
    "active": true,
    "withException": true,
    "createTimes": [
        {
            "operator": "gt",
            "value": "2021-12-01T01:00:00.000+0200"
        }
    ]
}
[
    {
        "id": "4624c39a-58d7-11ec-b10c-106530e88321",
        "jobDefinitionId": "5271f174-543d-11ec-8096-106530e88321",
        "processInstanceId": "460d6acc-58d7-11ec-b10c-106530e88321",
        "processDefinitionId": "defId",
        "processDefinitionKey": "defKey",
        "executionId": "460d6acc-58d7-11ec-b10c-106530e88321",
        "exceptionMessage": "someMessage",
        "failedActivityId": "someActivity",
        "retries": 0,
        "dueDate": "2021-12-09T16:20:15.295+0200",
        "suspended": false,
        "priority": 0,
        "tenantId": null,
        "createTime": "2021-12-09T12:03:35.967+0200"
    }
]

Best Regards,
Alex

Hello Alex,

I see this is an old topic but i found the same problem the other day and also found a fix for it. I opened it as an issue in camundas github and provided a pull request.

Issue: Set Job Retries Async (POST) throws NPE when request body contains createTimes or dueDates · Issue #3185 · camunda/camunda-bpm-platform · GitHub
Pull Request: fix #3185: set objectMapper on JobQueryDto by flok32 · Pull Request #3187 · camunda/camunda-bpm-platform · GitHub

Best Regards, Florian