{"record":{"id":"31019809f0429652","repo":"flowable/flowable-engine","slug":"org-apache-http-entity-mime-multipartentitybuilder","errorCode":null,"errorMessage":"org.apache.http.entity.mime.MultipartEntityBuilder is not present on the classpath. Multi value parts cannot be used. If you want to use, please make sure that the org.apache.httpcomponents:httpmime dependency is available","messagePattern":"org\\.apache\\.http\\.entity\\.mime\\.MultipartEntityBuilder is not present on the classpath\\. Multi value parts cannot be used\\. If you want to use, please make sure that the org\\.apache\\.httpcomponents:httpmime dependency is available","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-http-common/src/main/java/org/flowable/http/common/impl/apache/ApacheHttpComponentsFlowableHttpClient.java","lineNumber":279,"sourceCode":"                    if (value instanceof byte[]) {\n                        if (StringUtils.isNotBlank(part.getMimeType())) {\n                            entityBuilder.addBinaryBody(name, (byte[]) value, ContentType.create(part.getMimeType()), part.getFilename());\n                        } else {\n                            entityBuilder.addBinaryBody(name, (byte[]) value, ContentType.DEFAULT_BINARY, part.getFilename());\n                        }\n                    } else if (value instanceof String) {\n                        if (StringUtils.isNotBlank(part.getMimeType())) {\n                            entityBuilder.addTextBody(name, (String) value, ContentType.create(part.getMimeType()));\n                        } else {\n                            entityBuilder.addTextBody(name, (String) value);\n                        }\n                    } else if (value != null) {\n                        throw new FlowableIllegalArgumentException(\"Value of type \" + value.getClass() + \" is not supported as multi part content\");\n                    }\n                }\n                requestBase.setEntity(entityBuilder.build());\n            } else {\n                throw new FlowableException(\"org.apache.http.entity.mime.MultipartEntityBuilder is not present on the classpath.\"\n                        + \" Multi value parts cannot be used.\"\n                        + \" If you want to use, please make sure that the org.apache.httpcomponents:httpmime dependency is available\");\n            }\n\n        } else if (requestInfo.getFormParameters() != null) {\n            Map<String, List<String>> formParameters = requestInfo.getFormParameters();\n            List<BasicNameValuePair> parameters = new ArrayList<>(formParameters.size());\n            for (Map.Entry<String, List<String>> entry : formParameters.entrySet()) {\n                String name = entry.getKey();\n                for (String value : entry.getValue()) {\n                    parameters.add(new BasicNameValuePair(name, value));\n                }\n            }\n\n            if (StringUtils.isNotEmpty(requestInfo.getBodyEncoding())) {\n                requestBase.setEntity(new UrlEncodedFormEntity(parameters, requestInfo.getBodyEncoding()));\n            } else {\n                requestBase.setEntity(new UrlEncodedFormEntity(parameters));","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-http-common/src/main/java/org/flowable/http/common/impl/apache/ApacheHttpComponentsFlowableHttpClient.java#L261-L297","documentation":"Flowable's Apache HttpClient 4.x based HTTP client supports multi-value multipart request bodies only when the optional `org.apache.httpcomponents:httpmime` artifact is on the classpath. `MultipartEntityBuilder` lives in that optional dependency; when it is absent, `setRequestEntity` refuses to build multipart requests rather than failing later with a NoClassDefFoundError. This is an explicit, early capability check.","triggerScenarios":"Calling `call()`/`prepareRequest()` on an `ApacheHttpComponentsFlowableHttpClient` with a `FlowableHttpRequestInfo` whose `multiValuePartParameters` (multi value parts) is non-empty while `org.apache.http.entity.mime.MultipartEntityBuilder` is not resolvable on the classpath.","commonSituations":"Using `flowable-http` in a Spring Boot app without adding httpmime; relying on a transitive httpclient dependency that excludes httpmime; upgrading to httpclient 5.x where the artifact coordinates changed (`org.apache.httpcomponents.client5:httpclient5`), leaving the old optional dep out.","solutions":["Add the dependency: Maven `org.apache.httpcomponents:httpmime` (version matching your httpclient 4.x), or Gradle `implementation 'org.apache.httpcomponents:httpmime:4.5.14'`.","If you do not need multipart bodies, stop sending multi value part parameters in the HTTP task/request configuration and use body/form parameters instead.","Verify with `mvn dependency:tree | grep httpmime` (or Gradle equivalent) that httpmime is actually resolved into the runtime classpath, not marked provided/optional."],"exampleFix":"// before (pom.xml) - httpclient without httpmime\n<dependency>\n  <groupId>org.apache.httpcomponents</groupId>\n  <artifactId>httpclient</artifactId>\n  <version>4.5.14</version>\n</dependency>\n\n// after - add the optional httpmime dependency\n<dependency>\n  <groupId>org.apache.httpcomponents</groupId>\n  <artifactId>httpclient</artifactId>\n  <version>4.5.14</version>\n</dependency>\n<dependency>\n  <groupId>org.apache.httpcomponents</groupId>\n  <artifactId>httpmime</artifactId>\n  <version>4.5.14</version>\n</dependency>","handlingStrategy":"validation","validationCode":"boolean multipartSupported;\ntry {\n  Class.forName(\"org.apache.http.entity.mime.MultipartEntityBuilder\");\n  multipartSupported = true;\n} catch (ClassNotFoundException e) {\n  multipartSupported = false;\n}\nif (requestInfo.getMultiValuePartParameters() != null && !requestInfo.getMultiValuePartParameters().isEmpty() && !multipartSupported) {\n  throw new IllegalStateException(\"Add org.apache.httpcomponents:httpmime to the classpath before using multi value parts\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    response = client.call(requestInfo);\n} catch (FlowableException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"MultipartEntityBuilder\")) {\n        // fall back to form parameters or fail fast with a config hint\n    }\n}","preventionTips":["Always ship httpmime alongside httpclient 4.x when the HTTP tasks may use multipart bodies.","Add a startup smoke test or Class.forName check that fails fast on missing multipart support.","Avoid multi value parts unless actually required; prefer form or body parameters."],"tags":["classpath","dependency","multipart","http-client"],"backgroundTag":"missing-optional-dependency","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}