zoukankan      html  css  js  c++  java
  • 解决启动时报ClassNotFoundException: org.apache.http.client.HttpClient异常的问题

    最近在研究阿里的分布式事务框架GTS,在运行sample-txc-simple时,抛以下异常:

    JM.Log:INFO Set diamond-client log path: C:Userschansonlogsdiamond-client
    Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: org.apache.http.client.HttpClient
        at com.taobao.txc.common.config.ConsoleConfig.g(Unknown Source)
        at com.taobao.txc.common.config.ConsoleConfig.<init>(Unknown Source)
        at com.taobao.txc.common.config.ConsoleConfig.a(Unknown Source)
        at com.taobao.txc.common.config.o.a(Unknown Source)
        at com.taobao.txc.common.config.o.a(Unknown Source)
        at com.taobao.txc.common.LoggerWrap.a(Unknown Source)
        at com.taobao.txc.common.config.o.a(Unknown Source)
        at com.taobao.txc.client.a.a(Unknown Source)
        at com.taobao.txc.client.a.<init>(Unknown Source)
        at com.taobao.txc.client.a.a(Unknown Source)
        at com.taobao.txc.client.aop.TxcTransactionScaner.a(Unknown Source)
        at com.taobao.txc.client.aop.TxcTransactionScaner.onApplicationEvent(Unknown Source)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:96)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
        at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:954)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
        at com.taobao.txc.test.Simple.main(Simple.java:39)
    Caused by: java.lang.ClassNotFoundException: org.apache.http.client.HttpClient
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)

    解决方案:

    把pom.xml文件中的httpclient版本调高到4.5.3即可。

      <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <version>4.5.3</version>
            </dependency>
  • 相关阅读:
    spring3 上配置quartz 任务调度
    读取.properties配置信息
    mybatis 返回值
    div根据鼠标的移入移除显示隐藏
    jquery日期控件+时分秒
    mysql 插入多条记录,重复值不插入
    Hadoop中Writable类
    Hadoop中WritableComparable 和 comparator
    Hadoop序列化
    Hadoop压缩之MapReduce中使用压缩
  • 原文地址:https://www.cnblogs.com/qingmuchuanqi48/p/14222501.html
Copyright © 2011-2022 走看看