java.lang.ClassNotFoundException: org.apache.http.util.Args - 我应该添加哪个依赖项?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28948599/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 07:03:48  来源:igfitidea点击:

java.lang.ClassNotFoundException: org.apache.http.util.Args - Which dependency should I add?

javaspringapachemaven

提问by user4419675

I'm running a Java application and had the following error:

我正在运行 Java 应用程序并出现以下错误:

java.lang.ClassNotFoundException: org.apache.http.util.Args

java.lang.ClassNotFoundException: org.apache.http.util.Args

I believe that the issue is that one library is trying to use this org.apache.http.util.Argsclass with reflection, but is not finding it.

我认为问题在于一个库试图org.apache.http.util.Args通过反射使用这个类,但没有找到它。

What should I add in my Maven pom.xml file to resolve this dependency?

我应该在我的 Maven pom.xml 文件中添加什么来解决这个依赖?

My classpath already contains the following reference that should be related with this class:

我的类路径已经包含以下应该与此类相关的参考:

<classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpcore/4.2.4/httpcore-4.2.4.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpcore/4.2.4/httpcore-4.2.4-sources.jar"/>

My pom.xmlfile:

我的pom.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.springframework</groupId>
    <artifactId>gs-rest-service</artifactId>
    <version>0.1.0</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.2.2.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>


    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-releases</id>
            <url>https://repo.spring.io/libs-release</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-releases</id>
            <url>https://repo.spring.io/libs-release</url>
        </pluginRepository>
    </pluginRepositories>
</project>

采纳答案by René Winkler

You need to add the follwoing dependency:

您需要添加以下依赖项:

<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpcore</artifactId>
    <version>4.4</version>
</dependency>

回答by GhostCat

And for the future: typically, your favorite search engine can tell you which jar file you need; searching for

对于未来:通常,您最喜欢的搜索引擎会告诉您需要哪个 jar 文件;寻找

"org.apache.http.util.Args which jar"

“org.apache.http.util.Args 哪个 jar”

directly send me to

直接发给我

http://www.java2s.com/Code/Jar/h/Downloadhttpcore43beta1jar.htm

http://www.java2s.com/Code/Jar/h/Downloadhttpcore43beta1jar.htm