# Issue when creating a Variable with a Java Object

**URL:** <https://forum.flowable.org/t/issue-when-creating-a-variable-with-a-java-object/7973>\
**Category:** Flowable Engine\
**Created:** [June 11, 2021, 4:13pm UTC](https://forum.flowable.org/t/issue-when-creating-a-variable-with-a-java-object/7973 "2021-06-11T16:13:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JosephARS](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@JosephARS](https://forum.flowable.org/u/JosephARS)\
**Post date:** [June 11, 2021, 4:13pm UTC](https://forum.flowable.org/t/issue-when-creating-a-variable-with-a-java-object/7973/1 "2021-06-11T16:13:29Z")

</div>

Hi,

Im trying to start a new instance process, with a process Variable type “document”, which a Java class I created. But once I execute the method " runtimeService.startProcessInstanceByKey", I get the following error:

couldn’t find a variable type that is able to serialize Document

It is a simple code to start my new instance:

public InstanceProcessDto registerNewCase(NewCase newCase) {

```
    Map<String, Object> variables = new HashMap<String, Object>();
    Document oDocuments = new Documento();

   oDocuments.setNombre(newCase.getDocumentos().getName());
   oDocuments.setUrlDescarga(newCase.getDocumentos().getUrl());
   variables.put("documents", oDocuments);
   variables.put("statusCase", newCase.getStatusCase());

    ProcessInstance processInstance =
            runtimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY, variables); 

```

}

---

<div class="post-metadata">

**Author:** ![jwashington](https://avatars.discourse-cdn.com/v4/letter/j/f6c823/32.png) [@jwashington](https://forum.flowable.org/u/jwashington)\
**Post date:** [June 12, 2021, 12:27am UTC](https://forum.flowable.org/t/issue-when-creating-a-variable-with-a-java-object/7973/2 "2021-06-12T00:27:49Z")

</div>

Java objects must be serializable in order to store them in a workflow variable. For simple objects, you can use the Serializable marker interface (i.e. Documento implements Serializable).

---

<div class="post-metadata">

**Author:** ![JosephARS](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@JosephARS](https://forum.flowable.org/u/JosephARS)\
**Post date:** [June 15, 2021, 3:42pm UTC](https://forum.flowable.org/t/issue-when-creating-a-variable-with-a-java-object/7973/3 "2021-06-15T15:42:46Z")

</div>

Thank you jwashington, it (Documento implements Serializable) solved my problem! Im actually storing a List and it works perfect.
