【问题标题】:Apache HTTPClient no such method ContentType.createApache HTTPClient 没有这样的方法 ContentType.create
【发布时间】:2016-01-26 09:26:55
【问题描述】:

我得到的堆栈跟踪是这样的。

[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)

触发的行是这个。

response = client.execute(httpPost);

【问题讨论】:

    标签: java apache httpclient


    【解决方案1】:

    在我看来,您要么缺少库,要么类路径中的库版本错误。我怀疑 httpcore 和/或 httpmime 库。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-12-14
      • 2015-08-01
      • 1970-01-01
      • 2019-01-11
      • 2017-10-02
      • 2014-02-24
      • 2017-03-10
      相关资源
      最近更新 更多