抛出java.lang.ClassNotFoundException:org.apache.http.util.Args - 哪些依赖我应该补充的吗? [英] java.lang.ClassNotFoundException: org.apache.http.util.Args - Which dependency should I add?

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

问题描述

我运行一个Java应用程序,并有以下错误:


  

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


我认为这个问题是一个库尝试使用此 org.apache.http.util.Args 类与反思,但还没找到。

我应该我在Maven的pom.xml文件添加到解决这种依赖?

我的类路径中已经包含下列内容的参考,应与这个类有关:

 < classpathentry样=VAR路径=M2_REPO /组织/阿帕奇/ httpcomponents / HttpClient的/ 4.3.6 / HttpClient的-4.3.6.jar源路径=M2_REPO /组织/阿帕奇/ httpcomponents / HttpClient的/ 4.3.6 / HttpClient的-4.3.6-sources.jar/>
< classpathentry样=VAR路径=M2_REPO /组织/阿帕奇/ httpcomponents /的HttpCore / 4.2.4 /的HttpCore-4.2.4.jar源路径=M2_REPO /组织/阿帕奇/ httpcomponents /的HttpCore / 4.2.4 /的HttpCore-4.2.4-sources.jar/>

我的的pom.xml 文件:

 <?XML版本=1.0编码=UTF-8&GT?;
<项目的xmlns =htt​​p://maven.apache.org/POM/4.0.0的xmlns:XSI =htt​​p://www.w3.org/2001/XMLSchema-instance
    XSI:的schemaLocation =htt​​p://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">
    < modelVersion> 4.0.0< / modelVersion>    <&的groupId GT; org.springframework< /的groupId>
    <&的artifactId GT; GS-REST的服务和LT; / artifactId的>
    <&版GT; 0.1.0< /版本>    &所述亲本GT;
        <&的groupId GT; org.springframework.boot< /的groupId>
        <&的artifactId GT;春开机起动亲和LT; / artifactId的>
        <&版GT; 1.2.2.RELEASE< /版本>
    < /母体GT;    <依赖和GT;
        <&依赖性GT;
            <&的groupId GT; org.springframework.boot< /的groupId>
            <&的artifactId GT;弹簧引导启动的Web< / artifactId的>
        < /依赖性>
    < /依赖和GT;
    <建立>
        <&插件GT;
            <&插件GT;
                <&的groupId GT; org.springframework.boot< /的groupId>
                <&的artifactId GT;弹簧引导Maven的插件和LT; / artifactId的>
            < /插件>
        < /插件>
    < /构建>    <库>
        <&库GT;
            <&ID GT;弹簧释放< / ID>
            &LT; URL&GT;的https://repo.spring.io/libs-release< / URL&GT;
        &LT; /存储库&GT;
    &LT; /存储库&GT;
    &LT; pluginRepositories&GT;
        &LT; pluginRepository&GT;
            &LT;&ID GT;弹簧释放&LT; / ID&GT;
            &LT; URL&GT;的https://repo.spring.io/libs-release< / URL&GT;
        &LT; / pluginRepository&GT;
    &LT; / pluginRepositories&GT;
&LT; /项目&GT;


解决方案

您需要添加follwoing依赖性:

 &LT;&依赖性GT;
    &LT;&的groupId GT; org.apache.httpcomponents&LT; /的groupId&GT;
    &LT;&的artifactId GT;的HttpCore&LT; / artifactId的&GT;
    &LT;&版GT; 4.4&LT; /版本&GT;
&LT; /依赖性&GT;

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

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.Args class with reflection, but is not finding it.

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

My pom.xml file:

<?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天全站免登陆