Apache HTTPClient 没有这样的方法 ContentType.create
Apache HTTPClient no such method ContentType.create
我得到的堆栈跟踪是这样的。
[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);
在我看来,您要么缺少某个库,要么您的类路径中的库版本有误。我怀疑 httpcore and/or httpmime 库。
我得到的堆栈跟踪是这样的。
[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);
在我看来,您要么缺少某个库,要么您的类路径中的库版本有误。我怀疑 httpcore and/or httpmime 库。