Use Classes form an extern jar file

Hi.

I create a jar file with some classes.
In my process, I need to instantiate an object from this jar and update it by using a setter.

Here is my class :

public class Sujet {
private String identifiantBDD;
private String idReleaseMajeure;

public Sujet(String identifiantBDD) {
    this.identifiantBDD = identifiantBDD;
}

public void setIdReleaseMajeure(String idReleaseMajeure) {
    this.idReleaseMajeure = idReleaseMajeure;
}

}

I import my jar and add it in the dependencies.
In my process data I have a variable of type “Sujet”.
In the first task, I try to initialize with a groovy code in a script task. My variable “sujet” takes value of this script :

import fr.geodis.bm.release.Sujet;
Sujet s = new Sujet(idTechniqueSujet);
s.setIdReleaseMajeure(idRelease);
return s;

It doesn’t work and I have this in the log :

2015-02-09 15:21:05 org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork
AVERTISSEMENT: THREAD_ID=371 | HOSTNAME=W28323 | TENANT_ID=1 | The work [ExecuteFlowNodeWork: processInstanceId:63, flowNodeInstanceId: 270] failed. The failure will be handled.
2015-02-09 15:21:05 org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork
AVERTISSEMENT: THREAD_ID=371 | HOSTNAME=W28323 | TENANT_ID=1 | org.bonitasoft.engine.core.process.instance.api.exceptions.SActivityStateExecutionException :
“PROCESS_DEFINITION_ID=6372878694415759794 | PROCESS_NAME=Cycle de vie sujet | PROCESS_VERSION=1.5 | PROCESS_INSTANCE_ID=63 | ROOT_PROCESS_INSTANCE_ID=63 |
FLOW_NODE_DEFINITION_ID=-8457190994004587551 | FLOW_NODE_INSTANCE_ID=270 | FLOW_NODE_NAME=Initialiser sujet |
org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.data.instance.exception.SUpdateDataInstanceException:
Impossible to update data instance ‘sujet’: org.bonitasoft.engine.services.SPersistenceException: Problem while updating entity: org.bonitasoft.engine.data.instance.model.impl.SXMLObjectDataInstanceImpl@b5fd1eda with id: 557”

What am I doing wrong ?

After some tests and research, I find that my class need to implement Serializable.

I modify it like this :

public class Sujet implements Serializable{
private String identifiantBDD;
private String idReleaseMajeure;

public Sujet(String identifiantBDD) {
this.identifiantBDD = identifiantBDD;
}
 
public void setIdReleaseMajeure(String idReleaseMajeure) {
this.idReleaseMajeure = idReleaseMajeure;
}
}

Now it works.