Claim task with API throws internal server error


#1

Hi,

Thanks in advance for any help.

I’m testing Camunda API. I can successifully perform some operations like unclaim, get tasks list, but I get an internal error on for example claim operation. I seem the problem is with authentication. I’ve enabled authentication section in filter and added init parameter to engine-rest’s web.xml as explained in https://docs.camunda.org/manual/7.6/reference/rest/overview/authentication/
Details are as follows:
POST URL: http://localhost:8080/engine-rest/task/cadbe3a4-0c4e-11e7-bb2f-4604cabf065a/claim
Headers: Content-Type: application/json
Authorization: Basic ZGVtbzpkZW1v
(user/pass are demo/demo. I base64 encoded demo:demo)
I’m using ARC Chrome app. The same URL works fine with unclaim
Exception is:
500 Internal Server Error

Apache Tomcat/8.0.24 - Error reportH1 {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;}.line {height: 1px; background-color: #525D76; border: none;}

HTTP Status 500 - java.lang.NullPointerException

type Exception report

message java.lang.NullPointerException

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException
org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:365)
org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:233)
org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:209)
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:557)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
org.jboss.resteasy.core.SynchronousDispatcher.invokePropagateNotFound(SynchronousDispatcher.java:169)
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:212)
org.jboss.resteasy.plugins.server.servlet.FilterDispatcher.doFilter(FilterDispatcher.java:59)
org.camunda.bpm.engine.rest.security.auth.ProcessEngineAuthenticationFilter.doFilter(ProcessEngineAuthenticationFilter.java:148)
org.camunda.bpm.engine.rest.filter.CacheControlFilter.doFilter(CacheControlFilter.java:41)

root cause

java.lang.NullPointerException
org.camunda.bpm.engine.rest.sub.task.impl.TaskResourceImpl.claim(TaskResourceImpl.java:81)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:483)
org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)
org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)
org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:159)
org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:107)
org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:154)
org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:92)
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
org.jboss.resteasy.core.SynchronousDispatcher.invokePropagateNotFound(SynchronousDispatcher.java:169)
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:212)
org.jboss.resteasy.plugins.server.servlet.FilterDispatcher.doFilter(FilterDispatcher.java:59)
org.camunda.bpm.engine.rest.security.auth.ProcessEngineAuthenticationFilter.doFilter(ProcessEngineAuthenticationFilter.java:148)
org.camunda.bpm.engine.rest.filter.CacheControlFilter.doFilter(CacheControlFilter.java:41)

note The full stack trace of the root cause is available in the Apache Tomcat/8.0.24 logs.


Apache Tomcat/8.0.24


#2

Though I’m calling the taskService.claim(id, name) from the Java API, it is working on my Wildfly v1010 server with Camunda v7.6.2.

// query task
Task task = taskService
        .createTaskQuery()
        .processInstanceId(pVariablesInReturn.getProcessInstanceId())
        .active()
        .singleResult();

LOGGER.info("*** task getName: "+ task.getName());
LOGGER.info("*** task getId: "+ task.getId());
// before claiming
LOGGER.info("*** task getAssignee before claim: "+ task.getAssignee());

// claim task for logged in user
taskService.claim(task.getId(), loginName);

// query task after claim
Task taskAfterClaim = taskService
        .createTaskQuery()
        .processInstanceId(pVariablesInReturn.getProcessInstanceId())
        .active()
        .singleResult();

// after claiming
LOGGER.info("*** task getAssignee after claim: "+ taskAfterClaim.getAssignee());

#3

What is the request body you are sending?


#4

Hi, thank you for support. I didn’t include request body :slight_smile: