首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >java使用hbase、hadoop报错举例

java使用hbase、hadoop报错举例

原创
作者头像
刘大猫
发布2025-09-27 14:30:14
发布2025-09-27 14:30:14
380
举报
文章被收录于专栏:JAVA相关JAVA相关

@TOC

摘要

总结自己springboot项目使用hbase、hadoop中出现的莫名奇怪的依赖使用报错

代码语言:java
复制
hbase   2.0.2版本
hadoop  3.1.1版本

==注意==:本地依赖版本最好和服务器上版本一致,避免发生莫名奇怪错误

情况1:NoClassDefFoundError

代码语言:java
复制
java.lang.NoClassDefFoundError: org/apache/hadoop/tracing/SpanReceiverHost
	at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:643) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:628) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:149) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:3354) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:124) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:3403) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:3371) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:477) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at org.apache.hadoop.fs.FileSystem$1.run(FileSystem.java:216) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at org.apache.hadoop.fs.FileSystem$1.run(FileSystem.java:213) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_231]
	at javax.security.auth.Subject.doAs(Subject.java:422) ~[na:1.8.0_231]
	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1729) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:213) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at com.geespace.microservices.directory.assets.service.impl.DataAssetsScreenServiceImpl.updateAssetsSize(DataAssetsScreenServiceImpl.java:149) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at com.geespace.microservices.directory.assets.service.impl.DataAssetsScreenServiceImpl$$FastClassBySpringCGLIB$$cc83a803.invoke(<generated>) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115) ~[api-gateway-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_231]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_231]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_231]
	at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_231]
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.tracing.SpanReceiverHost
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_231]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[na:1.8.0_231]
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) ~[na:1.8.0_231]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[na:1.8.0_231]
	... 27 common frames omitted	

==原因==:碰到这种xxxxxClass未找到,就说明服务器上使用jar包版本不对,导致找不到类,原因就是jar出现多版本导致的,这个类出现在hadoop-common 2.7.7中,而我要使用的是3.1.1版本,不应该出现这个对象

==解决思路==:pom依赖使用<exclusion>标签进行依赖冲突排除,确保最后只有一个版本即可(也就是把乱七八糟jar内部引入的版本全部排除调)

情况2:使用hbase报错:NullPointerException

下面这句使用报错 ↓

代码语言:java
复制
 FileSystem fs = FileSystem.get(new URI(hdfsPath), configuration, hdfsName);

==原因==:报空指针就是没有进行初始化,而直接调用方法导致的

==解决思路==:写到一起或者初始化后再使用即可

情况3:summary.typeQuotaInfos.typeQuotaInfo3.type

查看这篇文章即可 -> : https://blog.csdn.net/a924382407/article/details/117441247?spm=1001.2014.3001.5501

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 摘要
  • 情况1:NoClassDefFoundError
  • 情况2:使用hbase报错:NullPointerException
  • 情况3:summary.typeQuotaInfos.typeQuotaInfo3.type
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档