Hbase 中 在创建连接时报错
Caused by: java.lang.ClassNotFoundException: org.apache.zookeeper.KeeperException
异常信息:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/zookeeperKeeperException
at org.apache.hadoop.hbase.client.HConnectionManager.getConnection(HConnectionManager.java:185)
at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:154)
at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:132)
at HBaseConnector.main(HBaseConnector.java:27)Caused by: java.lang.ClassNotFoundException: org.apache.zookeeper.KeeperException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)... 4 more
因为我的项目是在springboot中,使用的是TDH 星环的大数据产品,在引入jar 包时没有引入zookeeper的包。
以后注意所有的ClassNotFoundException 异常,都是缺少jar包 或者jar包没有放到环境变量导致的。