Been scratching my head for a while on this one. I'm just getting started with using PHP/Thrift to communicate with HBase (I can do it fine w/Python). For some reason the code below is generating class 'HbaseClient' not found on the $client = new line:
$GLOBALS['THRIFT_ROOT'] = 'thrift';
require_once( $GLOBALS['THRIFT_ROOT'] . '/Thrift.php' );
require_once( $GLOBALS['THRIFT_ROOT'] . '/transport/TSocket.php' );
require_once( $GLOBALS['THRIFT_ROOT'] . '/transport/TBufferedTransport.php' );
require_once( $GLOBALS['THRIFT_ROOT'] . '/protocol/TBinaryProtocol.php' );
require_once( $GLOBALS['THRIFT_ROOT'] . '/Hbase/Hbase.php' );
try
{
$socket = new TSocket('127.0.0.1', 9090);
$transport = new TBufferedTransport($socket, 1024, 1024);
$protocol = new TBinaryProtocolAccelerated($transport);
$client = new HbaseClient( $protocol );
$transport->open();
}
catch (Exception $e)
{
echo "Exception: %e\r\n";
}
I have literally no idea why. In the Hbase.php include file the client is defined as such:
class HbaseClient implements \Hbase\HbaseIf {
Am I missing something glaringly simple here? (Full HBase.php here: http://pastebin.com/6kd9r2Se )
Thanks in advance!
I believe this is a namespace issue. Try putting :
namespace Hbase;
in the file instantiating the object or use the fully qualified name:
$client = new Hbase\HbaseClient( $protocol );