简体   繁体   English

同时使用apache httpclient 4.3.2和httpclient 4.1.2

[英]Use apache httpclient 4.3.2 and httpclient 4.1.2 at the same time

I'm stuck in a project where I have two dependencies that seem to be contradicting themselves. 我被困在一个有两个相互矛盾的依赖的项目中。

One lib is apache's httpClient 4.1.* and the other is apache's HttpClient 4.3.*. 一个库是apache的httpClient 4.1。*,另一个是apache的HttpClient 4.3。*。

Is there a way to have HttpClient 4.3.* and keep it backwards compatible with 4.1.*? 有没有办法让HttpClient 4.3。*并使其与4.1。*向后兼容?
According to the javadoc, the interface is deprecated, not removed. 根据javadoc,不建议使用该接口,而不是将其删除。

When I try to use just the 4.3.2, I get: 当我尝试仅使用4.3.2时,我得到:

java.lang.ClassNotFoundException: org.apache.http.protocol.HttpContext java.lang.ClassNotFoundException:org.apache.http.protocol.HttpContext

I'm running on Tomcat 7.0.50 and I'm running on eclipse 我在Tomcat 7.0.50上运行,在eclipse上运行

In the end, this happened because of the IDE I am using (eclipse) even though I once tell that I want to use all dependencies on the server I have it associated with (in this case, tomcat 7.0), It didn't update when I had added this HttpClient 4.3.2. 最后,这是由于我正在使用(Eclipse)的IDE而发生的,即使我曾经告诉过我要使用与之关联的服务器上的所有依赖项(在本例中为tomcat 7.0),也没有更新当我添加此HttpClient 4.3.2时。
Furthermore, the program was giving problems in one of the sub-systems that was requiring 4.1.* in a class that is classified as deprecated in 4.3.2. 此外,该程序在需要4.1。*的一个子系统中出现了问题,该子系统在4.3.2中已弃用。

It was just a series of coincidences (and misreading the manual or gap in the manual) that lead to my misinterpretation of what was really happening. 仅仅是一系列的巧合(以及对手册的误读或手册中的空白)导致了我对实际情况的误解。

On eclipse , to add libraries from the project to make them available from the server, use this tool: eclipse上 ,要从项目中添加库以使它们可从服务器使用,请使用以下工具:

project -> properties -> deployment assembly

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM