Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache HTTPClient no such method ContentType.create

The stacktrace im getting is this.

[04:18:36 WARN]: java.lang.NoSuchMethodError: org.apache.http.entity.ContentType.create(Ljava/lang/String;[Lorg/apache/http/NameValuePair;)Lorg/apache/http/entity/ContentType;
[04:18:36 WARN]:        at org.apache.http.entity.mime.MultipartEntityBuilder.buildEntity(MultipartEntityBuilder.java:219)
[04:18:36 WARN]:        at org.apache.http.entity.mime.MultipartEntity.getEntity(MultipartEntity.java:119)
[04:18:36 WARN]:        at org.apache.http.entity.mime.MultipartEntity.isChunked(MultipartEntity.java:138)
[04:18:36 WARN]:        at org.apache.http.protocol.RequestContent.process(RequestContent.java:105)
[04:18:36 WARN]:        at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:131)
[04:18:36 WARN]:        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:193)
[04:18:36 WARN]:        at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
[04:18:36 WARN]:        at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)

The line this gets triggered at is this.

response = client.execute(httpPost);
like image 507
117 Avatar asked Feb 07 '23 22:02

117


1 Answers

Looks to me like you're either missing a library or that there's a wrong version of a library on your classpath. I suspect httpcore and/or httpmime libraries.

like image 60
Julien Charon Avatar answered Feb 12 '23 09:02

Julien Charon