Java调用Hbase出现java.lang.reflect.InvocationTargetException异常解决方案

Java调用Hbase出现java.lang.reflect.InvocationTargetException异常解决方案

  • 问题背景
  • 解决方案
  • Lyric:你我同个世界

问题背景

在连接Hbase时,出现反射错误

Exception in thread "main" java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:64)
Caused by: java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/protobuf/generated/MasterProtos$MasterService$BlockingInterface
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(ConnectionFactory.java:228)
	at org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(ConnectionFactory.java:218)
	at org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(ConnectionFactory.java:119)
	at com.dazhen.data.api.util.test.HbaseDevTest.main(HbaseDevTest.java:28)
	... 5 more
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.protobuf.generated.MasterProtos$MasterService$BlockingInterface
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 11 more

Java调用Hbase出现java.lang.reflect.InvocationTargetException异常解决方案_第1张图片

解决方案

pom的依赖有冲突,把冲突项全部排除掉




作为程序员第 82 篇文章,每次写一句歌词记录一下,看看人生有几首歌的时间,wahahaha …

Lyric:你我同个世界

你可能感兴趣的:(java异常错误问题,hbase)