Exception while closing command context: Cannot find serializer for value 'Untyped value 'custom.pojo', isTransient = false' while unit testing(v.7.13.0))

We’re trying to write Unit test cases using JUnit in our project.

I’m following the below example to write cases, without using the camund.cfg.xml.

While trying to start the process instance, we need to pass certain complex objects(custom POJO) as variables as shown below:

public class Custom {
private String a;
private String b;
private String c;
private String d;
}

final ProcessInstance processInstance = runtimeService()
.startProcessInstanceByKey(PRODUCTION_PROCESS_KEY,
withVariables(
CaseVariables.Custom, custom,
CaseVariables.User, user,
CaseVariables.State, State));

However, when I run the test, I get following error:
Exception while closing command context: Cannot find serializer for value ‘Untyped value ‘custom.pojo’, isTransient = false’.

We have Spin added as the dependency in our POM.xml.

Request you to please help me understand what is going wrong here.

Hi Guys,

Could anyone please help us out here.

P.S. Making our custom POJO implement serializable is not an option as it’s a third part library provided class.

You will have to register the spin plugin manually at the processEngineConfiguration if you are not using spring or the cfg.xml.

something like this:

@Rule
public final ProcessEngineRule camunda = new ProcessEngineRule(
   new StandaloneInMemProcessEngineConfiguration() {{
      getProcessEnginePlugins().add(new SpinProcessEnginePlugin());
      // plus all the other config stuff 
}}
);
3 Likes

Hey @jangalinski,

Thank you for your response.

We’re using processes.xml as the deployment descriptor and would not like to add either activity.cgf.xml or camunda.cfg.xml merely for the sake of testing.

We also have Spin added as a dependency in our POM.xml.

Do you think it’s possible to achieve this?