Cannot find serializer for value!r

Hi,
I have a simple workflow. A user form has one text field called item and one number field called amount . When starting the Process I set the inital values.
In the externalTaskClient I want to catch these values. But the number field causes an error
String item = externalTask.getVariable(“item”); // THIS WORKS
Integer amount = (Integer) externalTask.getVariable(“amount”); // THIS DOESN’T

[TopicSubscriptionManager] ERROR org.camunda.bpm.client - TASK/CLIENT-03004 Exception on external task service method invocation for topic ‘charge-card’:
org.camunda.bpm.client.exception.ValueMapperException: TASK/CLIENT-01024 Cannot find serializer for value ‘8’
at org.camunda.bpm.client.impl.ExternalTaskClientLogger.valueMapperExceptionDueToSerializerNotFoundForTypedValueField(ExternalTaskClientLogger.java:197)
at org.camunda.bpm.client.variable.impl.DefaultValueMappers.findMapperForTypedValueField(DefaultValueMappers.java:82)
at org.camunda.bpm.client.variable.impl.VariableValue.getSerializer(VariableValue.java:77)
at org.camunda.bpm.client.variable.impl.VariableValue.getTypedValue(VariableValue.java:62)
at org.camunda.bpm.client.variable.impl.VariableValue.getTypedValue(VariableValue.java:50)
at org.camunda.bpm.client.variable.impl.VariableValue.getValue(VariableValue.java:41)
at org.camunda.bpm.client.task.impl.ExternalTaskImpl.getVariable(ExternalTaskImpl.java:250)
at ChargeCardWorker.lambda$0(ChargeCardWorker.java:27)
at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.handleExternalTask(TopicSubscriptionManager.java:155)
at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.lambda$acquire$0(TopicSubscriptionManager.java:109)
at java.base/java.util.Arrays$ArrayList.forEach(Arrays.java:4204)
at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.acquire(TopicSubscriptionManager.java:104)
at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.run(TopicSubscriptionManager.java:88)
at java.base/java.lang.Thread.run(Thread.java:833)

Hello my friend!

You may be casting a variable that may not be of type Integer… try using getVariableTyped() to get the value of this variable.

I hope this helps.

William Robert Alves

1 Like