我是靠谱客的博主 舒心白开水,这篇文章主要介绍java.lang.NoClassDefFoundError: Could not initialize class org.apache.hadoop.hbase.util.ByteStringer,现在分享给大家,希望可以做个参考。
2019独角兽企业重金招聘Python工程师标准>>>
报错:
复制代码
1java.lang.NoClassDefFoundError: Could not initialize class org.apache.hadoop.hbase.util.ByteStringer
原因:
在HBase 1.2.X版本及之前的版本HBase是强依赖于protobuf-2.5.0,如果在依赖中引入高版本的protobuf,会造成hbase的各种问题,所以在有HBase的项目中一定要慎重对待protobuf的版本
解决方法:
本地建一个工程将hbase jar包包裹起来,里面指定protobuf版本
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27<dependencyManagement> <dependencies> <dependency> <groupId>com.google.protobuf</groupId> <artifactId>protobuf-java</artifactId> <version>2.5.0</version> </dependency> <!--[TMS-391] Fix No Such Method Exception when connect HBase --> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>12.0.1</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>org.apache.hbase</groupId> <artifactId>hbase-client</artifactId> </dependency> </dependencies>
转载于:https://my.oschina.net/u/2000675/blog/3022067
最后
以上就是舒心白开水最近收集整理的关于java.lang.NoClassDefFoundError: Could not initialize class org.apache.hadoop.hbase.util.ByteStringer的全部内容,更多相关java.lang.NoClassDefFoundError:内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复