Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase, mail # user - ZKConfig.makeZKProps throwing NullPointerException


Copy link to this message
-
ZKConfig.makeZKProps throwing NullPointerException
Nichole Treadway 2011-08-14, 23:27
Hi all,

I am getting the below error when trying to create a new HTable object (see
end of email)...

I believe the error is occuring in the below function because the
getClassLoader() function is returning null. Because the way my application
is set up, I have to add all hbase, hadoop, and zookeeper-related jars to
the bootstrap classpath using the java "-Xbootclasspath/p" flag. I think
this is causing some kind of issue with the classloader. Any one have any
ideas what I can do to resolve this?

public static Properties makeZKProps(Configuration conf) {
    // First check if there is a zoo.cfg in the CLASSPATH. If so, simply
read
    // it and grab its configuration properties.
*    ClassLoader cl = HQuorumPeer.class.getClassLoader();*
*    final InputStream inputStream cl.getResourceAsStream(HConstants.ZOOKEEPER_CONFIG_NAME);*
    if (inputStream != null) {
      try {
        return parseZooCfg(conf, inputStream);
      } catch (IOException e) {
        LOG.warn("Cannot read " + HConstants.ZOOKEEPER_CONFIG_NAME +
                 ", loading from XML files", e);
      }
    }
Stacktrace:

11/08/14 19:18:43 java.lang.NullPointerException
at org.apache.hadoop.hbase.zookeeper.ZKConfig.makeZKProps(ZKConfig.java:65)
 at
org.apache.hadoop.hbase.zookeeper.ZKConfig.getZKQuorumServersString(ZKConfig.java:250)
at
org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.java:117)
 at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getZooKeeperWatcher(HConnectionManager.java:1255)
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.setupZookeeperTrackers(HConnectionManager.java:515)
 at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.<init>(HConnectionManager.java:506)
at
org.apache.hadoop.hbase.client.HConnectionManager.getConnection(HConnectionManager.java:180)
 at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:180)
at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:158)