Sorry, I forgot to mention:
I'm using hadoop-0.20-append, hbase-0.92 on two red hat 5.5 machines.
The function I pasted is in org.apache.hadoop.hbase.zookeeper.ZKConfig.
On Aug 14, 2011, at 7:27 PM, Nichole Treadway wrote:
> 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)