# Error while invoking deployment rest api

**URL:** <https://forum.flowable.org/t/error-while-invoking-deployment-rest-api/6341>\
**Category:** Uncategorized\
**Created:** [July 8, 2020, 1:04am UTC](https://forum.flowable.org/t/error-while-invoking-deployment-rest-api/6341 "2020-07-08T01:04:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![avarunprasath](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@avarunprasath](https://forum.flowable.org/u/avarunprasath)\
**Post date:** [July 8, 2020, 1:04am UTC](https://forum.flowable.org/t/error-while-invoking-deployment-rest-api/6341/1 "2020-07-08T01:04:46Z")

</div>

While attempting to upload the bpmn file using rest api as below, I am getting the error

**here is the code:**  
String serverUrl = [http://localhost:8080/flowable-rest/service/repository/deployments](http://localhost:8080/flowable-rest/service/repository/deployments)

HttpHeaders httpHeaders = setHeader(MediaType.APPLICATION\_JSON.toString(),MediaType.MULTIPART\_FORM\_DATA.toString(), “admin”, “test”);  
MultiValueMap\<String, Object\> body = new LinkedMultiValueMap\<\>();  
body.add(“file”, mpFile);  
HttpEntity\<MultiValueMap\<String, Object\>\> requestEntity = new HttpEntity\<\>(body, httpHeaders);  
ResponseEntity response = new RestTemplate().postForEntity(serverUrl, requestEntity, String.class);

\<\>

**getting the below error**

“status”: 500,  
“error”: “Internal Server Error”,  
“message”: "Type definition error: [simple type, class java.util.logging.ErrorManager]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class java.util.logging.ErrorManager and no properties discovered to create BeanSerializer  
(to avoid exception, disable SerializationFeature.FAIL\_ON\_EMPTY\_BEANS)

Kindly advise to resolve this.

---

<div class="post-metadata">

**Author:** ![chaserb](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/chaserb/32/3084_2.png) [@chaserb](https://forum.flowable.org/u/chaserb)\
**Post date:** [February 1, 2023, 10:02pm UTC](https://forum.flowable.org/t/error-while-invoking-deployment-rest-api/6341/2 "2023-02-01T22:02:09Z")

</div>

Not sure what your `setHeader(String, String, String, String)` method accomplishes. I’m hoping it takes that APPLICATION\_JSON media type and applies it to the “Accept” header, but it’s hard to know without the source code.

This works for me (multi-tenant variant):

```auto
private void deployWorkflow(final String tenantId, final String workflowFileName) throws Exception {

    LOG.debug("Deploying the process [{}] for tenant [{}]", workflowFileName, tenantId);

    // Read the process file and replace the tenant ID token
    final Path path = Path.of(ClassLoader.getSystemResource(workflowFileName).toURI());
    final String content = Files.readString(path);
    final ByteArrayResource contentResource = new ByteArrayResource(content.replace("{{tenantId}}", tenantId)
            .getBytes(StandardCharsets.UTF_8)) {
        @Override
        public String getFilename() {
            return workflowFileName;
        }
    };
    contentResource.getFilename();

    // Post the workflow to the workflow engine
    final String workflowUrl = properties.getWorkflowEngine().getUrl() + "process-api/repository/deployments";
    final MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
    body.add("file", contentResource);
    body.add("tenantId", tenantId);
    final RequestEntity<MultiValueMap<String, Object>> request = RequestEntity
            .post(new URI(workflowUrl))
            .accept(MediaType.APPLICATION_JSON)
            .contentType(MediaType.MULTIPART_FORM_DATA)
            .body(body);
    final ResponseEntity<Map<String, Object>> response = restTemplate.exchange(request,
            new ParameterizedTypeReference<>() {});
    if (response.getStatusCode() == HttpStatus.CREATED) {
        LOG.debug("Created workflow deployment [{}]", response.getBody());
    } else {
        LOG.error("Error creating workflow deployment [{}]", response.getStatusCode());
    }
}

```

Since I’m using a ByteArrayResource, I had to override getFilename() in order to add the filename to the content disposition:

```auto
Content-Disposition: form-data; name="file"; filename="Process_New_Hires.bpmn20.xml"
Content-Type: application/xml
Content-Length: 10805

```

Without that filename, I was getting 400 errors complaining about not providing a file.
