clickhouse-hdfs-loader
clickhouse-hdfs-loader copied to clipboard
java.lang.NoClassDefFoundError: org/apache/http/conn/HttpClientConnectionManager
当我执行任务时报错:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/conn/HttpClientConnectionManager
at ru.yandex.clickhouse.ClickHouseConnectionImpl.
我看到有人说是httpclient版本问题,
我修改pom.xml中版本为4.5.5还是不行:
请问是什么原因呢?求解答下
我现在用的jdbc: https://github.com/jaykelin/clickhouse-jdbc/tree/0.1-SNAPSHOT 用的httpclient版本:
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.5</version>
<scope>provided</scope>
</dependency>
@jaykelin 你好,我按你说的设置pom.xml,还是报同样的错误,麻烦看下我的pom.xml与你的有什么不同:
` <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>com.kugou</groupId>
<artifactId>clickhouse-hdfs-loader</artifactId>
<version>2.0.3</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hadoop.version>2.7.2</hadoop.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>${hadoop.version}</version>
<scope>provided</scope>
<!--<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</exclusion>
</exclusions>-->
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs</artifactId>
<version>${hadoop.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-common</artifactId>
<version>${hadoop.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-jobclient</artifactId>
<version>${hadoop.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-core</artifactId>
<version>${hadoop.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.orc</groupId>
<artifactId>orc-mapreduce</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>args4j</groupId>
<artifactId>args4j</artifactId>
<version>2.33</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ru.yandex.clickhouse</groupId>
<artifactId>clickhouse-jdbc</artifactId>
<version>0.1.40</version>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<!--<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<fork>true</fork>-->
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
`
建议使用我提供的那个jdbc
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.5</version>
<scope>provided</scope>
</dependency>
这个jar的版本是没有 HttpClientConnectionManager 的
@jaykelin 我用的就是你说的那个jdbc,是不是还需要修改代码呢
<dependency> <groupId>ru.yandex.clickhouse</groupId> <artifactId>clickhouse-jdbc</artifactId> <version>0.1.40</version> </dependency>
可以下载jdbc的代码,install到本地mvn仓库,完成jar依赖
Can you please help me? I am getting this error too, I tried a lot of pom.xml configurations. Can you please show valid pom.xml and commands for jar building?
@fibersel clone clickhouse-jdbc from https://github.com/jaykelin/clickhouse-jdbc/tree/0.1-SNAPSHOT cd ...../../clickhouse-jdbc && make install cd .../clickhouse-hdfs-loader && mvn clean package assembly:assembly -DskipTests
sorry, but i can't do make install, there is no any Makefile
my foult. it's mvn install
Here is full step-by-step guide for jar building:
git clone https://github.com/jaykelin/clickhouse-jdbc.git
git clone https://github.com/jaykelin/clickhouse-hdfs-loader.git
cd clickhouse-jdbs
git checkout 0.1-SNAPSHOT
mvn install -DskipTests
(tests run on clickhouse instance, running on your machine at port 8123, so we skip it)
cd ../clickhouse-hdfs-loader
mvn clean package assembly:assembly -DskipTests
after these commands you will get jars at "target" folder So you can submit hadoop job:
hadoop jar target/clickhouse-hdfs-loader-2.1.2-jar-with-dependencies.jar com.kugou.loader.clickhouse.ClickhouseHdfsLoader ...
@jaykelin , put these instruction to README please, it will make our life easier :)
@fibersel Thanks for the advice