NullPointerException 与 Zookeepers getZookeeperClusterKey
连接到 HBase 时,出现以下消息:
java.lang.NullPointerException
at java.lang.StringBuilder.<init>(StringBuilder.java:92)
at org.apache.hadoop.hbase.zookeeper.ZooKeeperWrapper.getZookeeperClusterKey(ZooKeeperWrapper.java:956)
配置中似乎存在问题。我没有使用 xml 文件进行配置,但在我的代码中执行此操作。 作为记录,这是我的代码的配置部分:
usersTable = new HTable(config, "users");
config.set("hbase.zookeeper.quorum", "student-serv002.test");
我使用 Spring DM 从 OSGi 应用程序运行它。
编辑:
第 956 行周围的源代码如下:
public static String getZookeeperClusterKey(Configuration conf, String name) {
954 String quorum = conf.get(HConstants.ZOOKEEPER_QUORUM.replaceAll(
955 "[\\t\\n\\x0B\\f\\r]", ""));
956 StringBuilder builder = new StringBuilder(quorum);
957 builder.append(":");
958 builder.append(conf.get(HConstants.ZOOKEEPER_ZNODE_PARENT));
959 if (name != null && !name.isEmpty()) {
960 builder.append(",");
961 builder.append(name);
962 }
963 return builder.toString();
964 }
显然,仲裁值不会被读取。然而,在常规的非 OSGi 应用程序中使用相同的代码并不是问题。
编辑:使用不同的方式提供配置似乎产生了效果。我现在收到以下错误:
java.lang.NullPointerException
at org.apache.hadoop.hbase.client.HConnectionManager$ClientZKWatcher.getZooKeeperWrapper(HConnectionManager.java:231)
立即查看源代码。
When connecting to HBase, the following message occurs:
java.lang.NullPointerException
at java.lang.StringBuilder.<init>(StringBuilder.java:92)
at org.apache.hadoop.hbase.zookeeper.ZooKeeperWrapper.getZookeeperClusterKey(ZooKeeperWrapper.java:956)
There seems to be a problem in the configuration. I'm not using an xml-file for configuration, but do this in my code.
For the record, this is the configuration part of my code:
usersTable = new HTable(config, "users");
config.set("hbase.zookeeper.quorum", "student-serv002.test");
I'm running this from an OSGi application using Spring DM.
EDIT:
the source code around line 956 is the following:
public static String getZookeeperClusterKey(Configuration conf, String name) {
954 String quorum = conf.get(HConstants.ZOOKEEPER_QUORUM.replaceAll(
955 "[\\t\\n\\x0B\\f\\r]", ""));
956 StringBuilder builder = new StringBuilder(quorum);
957 builder.append(":");
958 builder.append(conf.get(HConstants.ZOOKEEPER_ZNODE_PARENT));
959 if (name != null && !name.isEmpty()) {
960 builder.append(",");
961 builder.append(name);
962 }
963 return builder.toString();
964 }
Obviously the value for quorum does not get read. Using the same code in a regular, non-OSGi application was not a problem however.
EDIT: using a different way of supplying the configuration seems to have had an effect. I now get the following error:
java.lang.NullPointerException
at org.apache.hadoop.hbase.client.HConnectionManager$ClientZKWatcher.getZooKeeperWrapper(HConnectionManager.java:231)
Looking into the source right now.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论