datart导入hive连接包

news/2025/2/22 18:50:48/

  datart读取hive数据时,需要先在datart的lib目录下导入hive jdbc相关的包,这里面有几个坑记录下:

1.和springboot中commons-lang3冲突

2.hive中带的jetty和springboot冲突

3.hive jdbc的包的版本号一定要小于登录hive服务端的版本,否则会报Required field ‘client_protocol’ is unset的错误,在引入hive jdbc包的时候,要先查看hive的版本,具体方法:可以找到hive的安装目录 whereis hive,查看hive lib目录下相关包的版本或者执行hive后,通过查看日志得到hive的版本。

最后在导入包的时候,一个个导比较麻烦,而且针对jar包冲突请求也不好处理,所以新建了个项目将所需的包引入,使用maven-shade-plugin插件进行打包并对冲突了的jar包进行重命名,消除冲突,最后的pom文件如下:

<?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.example</groupId><artifactId>hive-dependency</artifactId><version>1.0-SNAPSHOT</version><properties><maven.compiler.source>8</maven.compiler.source><maven.compiler.target>8</maven.compiler.target><hive.version>1.1.0</hive.version></properties><dependencies><!-- https://mvnrepository.com/artifact/org.apache.hive/hive-jdbc --><dependency><groupId>org.apache.hive</groupId><artifactId>hive-jdbc</artifactId><version>${hive.version}</version></dependency><dependency><groupId>org.apache.hadoop</groupId><artifactId>hadoop-common</artifactId><version>2.6.0</version></dependency><dependency><groupId>org.apache.hadoop</groupId><artifactId>hadoop-client</artifactId><version>2.7.1</version></dependency><dependency><groupId>org.apache.hive</groupId><artifactId>hive-exec</artifactId><version>${hive.version}</version><exclusions><exclusion><artifactId>commons-lang3</artifactId><groupId>org.apache.commons</groupId></exclusion></exclusions></dependency></dependencies><build><plugins><plugin><artifactId>maven-compiler-plugin</artifactId><configuration><source>1.8</source><target>1.8</target><encoding>UTF-8</encoding></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-shade-plugin</artifactId><version>2.4.3</version><executions><execution><phase>package</phase><goals><goal>shade</goal></goals><configuration><filters><filter><artifact>*:*</artifact><excludes><exclude>META-INF/*.SF</exclude><exclude>META-INF/*.DSA</exclude><exclude>META-INF/*.RSA</exclude><exclude>org/eclipse/*</exclude></excludes></filter></filters><relocations><relocation><pattern>org.apache.commons.lang3</pattern><shadedPattern>org.apache.commons.hive.lang3</shadedPattern></relocation><relocation><pattern>org.eclipse.jetty</pattern><shadedPattern>org.eclipse.hive.jetty</shadedPattern></relocation><relocation><pattern>org.mortbay</pattern><shadedPattern>org.mortbay.hive</shadedPattern></relocation></relocations></configuration></execution></executions></plugin></plugins></build><repositories><repository><id>aliyun</id><!--            <mirrorOf>*</mirrorOf>--><name>spring-plugin</name><url>https://maven.aliyun.com/repository/spring-plugin</url><releases><enabled>true</enabled></releases><snapshots><enabled>false</enabled></snapshots></repository></repositories>
</project>


http://www.ppmy.cn/news/1123558.html

相关文章

半年总结 -要有松弛感的慢生活

匆匆的半年就这样又过去了&#xff0c;菊次郎的夏天也过完了&#xff0c;国庆又要到了&#xff0c;正在发愁国庆节七天要干什么&#xff0c;然后前几天了解省考要提前到1月份&#xff0c;得&#xff0c;这下不就有事情要做了么&#x1f60f; 进入正题吧~ 工作 自从去年年末换…

【设计模式】门面模式

文章目录 1.门面模式定义2. 门面模式的角色3.门面模式实战案例3.1.场景说明3.2.关系图3.3.代码实现 4.门面模式优缺点5.门面模式适用场景6.门面模式总结 主页传送门&#xff1a;&#x1f481; 传送 1.门面模式定义 门面模式&#xff08;Facade Pattern&#xff09;也叫做外观模…

【linux】性能优化

这张图谱出自倪朋飞&#xff1b; 1、什么是性能指标 这里一定会想到 “高并发” 和 “响应快”&#xff0c;这里词正对应的就是 “吞吐” 和 “延时”。我们知道随着应用负载的体系&#xff0c;系统资源的使用就会提高&#xff0c;甚至达到极限。而性能问题的本质&#xff0c…

NextJS 引入 Ant-Design 样式闪烁问题

按照这里给的样例&#xff0c;抽出关键代码即可 步骤&#xff1a; 安装包&#xff1a; npm i ant-design/static-style-extract引入这俩文件 genAntdCss.tsx: 会帮我们生成 ./public/antd.min.css // src/scripts/genAntdCss.tsximport { extractStyle } from "ant-d…

C++学习笔记--移动语义和右值引用:现代C++基础

文章目录 前言&#xff1a;2.1、值类别2.1.1、左值和纯右值的对比2.1.2、亡值2.1.3、可以“移动”的对象2.1.4、何时使用std::move转换2.1.5、值类型总结 2.2、右值引用2.3、充分利用移动语义2.4、this指针类型 前言&#xff1a; 接上文 接下来将介绍在C11中的移动语义、值类别…

【跟小嘉学 PHP 程序设计】二、PHP 基本语法

系列文章目录 【跟小嘉学 PHP 程序设计】一、PHP 开发环境搭建 【跟小嘉学 PHP 程序设计】二、PHP 基本语法 文章目录 系列文章目录@[TOC](文章目录)前言一、PHP基本语法1.1、hello,world1.2、PHP语法的其他形式1.2.1、简短形式(了解即可)1.2.2、Script 风格1.2.3、ASP 风格1…

Go 多版本管理工具

Go 多版本管理工具 文章目录 Go 多版本管理工具一、go get 命令1.1 使用方法&#xff1a; 二、Goenv三、GVM (Go Version Manager)四、voidint/g4.1 安装4.2 冲突4.3 使用 在平时开发中&#xff0c;本地新旧项目并行开发的过程中&#xff0c;你大概率会遇到一个令人头疼的问题&…

Bug排查思路

遇到一个Bug&#xff0c;怎么排查&#xff1f;以下几个思路&#xff0c;希望能对大家有所启发 一、环境问题 1、开发的代码是否已更新 2、是否是缓存原因导致的&#xff08;强刷&#xff0c;手动清除缓存&#xff0c;web甚至可以直接用无恒模式查看页面&#xff09; 3、是否…