HBase API 操作报错:java.nio.channels.ClosedChannelException: null
使用代码操作HBase,但是报下面错误:
(图片来源网络,侵删)
15:50:38.527 [ReadOnlyZKClient-master:2181@0x04a94ee4] WARN org.apache.hadoop.hbase.zookeeper.ReadOnlyZKClient - 0x04a94ee4 to master:2181 failed for get of /hbase/hbaseid, code = CONNECTIONLOSS, retries = 8 15:50:39.528 [ReadOnlyZKClient-master:2181@0x04a94ee4-SendThread(master:2181)] INFO org.apache.zookeeper.client.FourLetterWordMain - connecting to master 2181 15:50:41.532 [ReadOnlyZKClient-master:2181@0x04a94ee4-SendThread(master:2181)] WARN org.apache.zookeeper.ClientCnxn - Can not get the principle name from server master 15:50:41.532 [ReadOnlyZKClient-master:2181@0x04a94ee4-SendThread(master:2181)] INFO org.apache.zookeeper.ClientCnxn - Using server principal zookeeper/master 15:50:41.532 [ReadOnlyZKClient-master:2181@0x04a94ee4-SendThread(master:2181)] INFO org.apache.zookeeper.ClientCnxn - Opening socket connection to server master/192.168.128.250:2181. Will not attempt to authenticate using SASL (unknown error) 15:50:43.538 [ReadOnlyZKClient-master:2181@0x04a94ee4-SendThread(master:2181)] WARN org.apache.zookeeper.ClientCnxn - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refused: no further information at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:364) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1432) 15:50:43.538 [ReadOnlyZKClient-master:2181@0x04a94ee4-SendThread(master:2181)] DEBUG org.apache.zookeeper.ClientCnxnSocketNIO - Ignoring exception during shutdown input java.nio.channels.ClosedChannelException: null at sun.nio.ch.SocketChannelImpl.shutdownInput(SocketChannelImpl.java:780) at sun.nio.ch.SocketAdaptor.shutdownInput(SocketAdaptor.java:399) at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:200) at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1553) at org.apache.zookeeper.ClientCnxn$SendThread.cleanAndNotifyState(ClientCnxn.java:1543) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1467) 15:50:43.538 [ReadOnlyZKClient-master:2181@0x04a94ee4-SendThread(master:2181)] DEBUG org.apache.zookeeper.ClientCnxnSocketNIO - Ignoring exception during shutdown output java.nio.channels.ClosedChannelException: null at sun.nio.ch.SocketChannelImpl.shutdownOutput(SocketChannelImpl.java:797) at sun.nio.ch.SocketAdaptor.shutdownOutput(SocketAdaptor.java:407) at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:207) at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1553) at org.apache.zookeeper.ClientCnxn$SendThread.cleanAndNotifyState(ClientCnxn.java:1543) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1467) 15:50:43.638 [ReadOnlyZKClient-master:2181@0x04a94ee4] WARN org.apache.hadoop.hbase.zookeeper.ReadOnlyZKClient - 0x04a94ee4 to master:2181 failed for get of /hbase/hbaseid, code = CONNECTIONLOSS, retries = 9 15:50:44.640 [ReadOnlyZKClient-master:2181@0x04a94ee4-SendThread(master:2181)] INFO org.apache.zookeeper.client.FourLetterWordMain - connecting to master 2181 15:50:46.647 [ReadOnlyZKClient-master:2181@0x04a94ee4-SendThread(master:2181)] WARN org.apache.zookeeper.ClientCnxn - Can not get the principle name from server master 15:50:46.647 [ReadOnlyZKClient-master:2181@0x04a94ee4-SendThread(master:2181)] INFO org.apache.zookeeper.ClientCnxn - Using server principal zookeeper/master 15:50:46.647 [ReadOnlyZKClient-master:2181@0x04a94ee4-SendThread(master:2181)] INFO org.apache.zookeeper.ClientCnxn - Opening socket connection to server master/192.168.128.250:2181. Will not attempt to authenticate using SASL (unknown error) Process finished with exit code 130
有可能是你链接Zookeeper的端口号写错了。
比如我的ZK信息为:ZKServer=master:2182
但是我故意写成:ZKServer=master:2181
那么就会报上面的错了。
文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。