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

标签 java spring apache maven

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

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

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

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

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

<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"/>

我的 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>

最佳答案

您需要添加以下依赖项:

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

关于java.lang.ClassNotFoundException : org. apache.http.util.Args - 我应该添加哪个依赖项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28948599/

相关文章:

java - Raspberry PI 2 Java 8 JVM 错误

java - 如何监控第三方库的方法执行?

java - 如何在没有@Id的情况下使用spring Repository?

java - 创建外部表配置单元,位置内部包含多个文件

java - 无法弄清楚正则表达式问题

java - 针对 Facebook 的客户端身份验证

linux - 网页加载时间问题。 wget 显示 "HTTP request sent, awaiting response... 301 Moved Permanently"

apache - Apache2 中的 401 自定义错误页面

java - 为什么我的 toast 不起作用? (安卓)

java - 如何使用 Tomcat linux 配置 Azure 应用服务的上下文路径