deGee
deGee

Reputation: 801

Cassandra_NotFound Exception when trying to instantiate a column_family object from phpcassa

I have setup a Cassandra instance 0.7 in my Windows 7 machine (64bit) .

The cassandra server is up and running and it is successfully listening to thrift clients. I have tested the instance by successfully creating my own sample keyspace and column family .

Now , I have to connect to this Cassandra instance from my PHP script . I tried using thobbs\phpcassa .

Here I ran into trouble . In the installation it's mentioned the steps for 'make,build' for UNIX/Linux system but nothing is mentioned for Windows .

Knowing not what to do next , I tried to copy the phpcassa folder inside my htdocs folder (of apache) and created a test file cassandra_test.php with the following content:

<?php
ini_set('display_errors',1);
require_once('phpcassa/connection.php');
require_once('phpcassa/columnfamily.php');

$servers = array("localhost:9160");
$pool = new ConnectionPool("demo", $servers);

$column_family = new ColumnFamily($pool, 'user');


?>

demo is the sample keyspace that I have created from the command prompt . Also , I have created a sample column_family user in my demo keyspace.

Executing this script in my browser gives me the following exception:

Fatal error: Uncaught exception 'cassandra_NotFoundException' in C:\Program Files   (x86)\Apache Software Foundation\Apache2.2\htdocs\phpcassa\columnfamily.php:198 
Stack trace: #0 C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\cassandra_test.php(10): 
ColumnFamily->__construct(Object(ConnectionPool), 'user') #1 {main} thrown in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\phpcassa\columnfamily.php
on line 198 

I think phpcassa can't find my local cassandra instance . How to check that ?

Also

$pool = new ConnectionPool("demo", $servers);

didn't gave any error/warning . So , I am entirely not sure what's the root cause for this exception? I am a newbie for cassandra and PHPcassa .Really sorry if this problem sounded pretty trivial.

Upvotes: 1

Views: 1118

Answers (1)

Tyler Hobbs
Tyler Hobbs

Reputation: 6932

This Exception indicates that it was able to connect to your Cassandra instance (probably without any problems), but that the ColumnFamily "user" in the keyspace "demo" does not exist.

Try starting cassandra-cli and verify that "show keyspaces;" lists the column family inside the correct keyspace. Also be aware that names are case-sensitive here, if that makes a difference.

Upvotes: 2

Related Questions