java.lang.ClassNotFoundException: org.apache.http.util.Args - 我应该添加哪个依赖项? [英] java.lang.ClassNotFoundException: org.apache.http.util.Args - Which dependency should I add?

查看:22
本文介绍了java.lang.ClassNotFoundException: org.apache.http.util.Args - 我应该添加哪个依赖项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

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

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

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

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

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

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

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

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

推荐答案

您需要添加以下依赖项:

You need to add the follwoing dependency:

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

这篇关于java.lang.ClassNotFoundException: org.apache.http.util.Args - 我应该添加哪个依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆