you are missing the column family in your keyspace.

If you are using the default definitions of schema shipped with cassandra,
ensure to load the schema from JMX.

thanks
ashish

2011/1/21 raoyixuan (Shandy) <raoyix...@huawei.com>

>  I exec the code as below by hector client:
>
>
>
> *package* com.riptano.cassandra.hector.example;
>
> *import* me.prettyprint.cassandra.serializers.StringSerializer;
>
> *import* me.prettyprint.hector.api.Cluster;
>
> *import* me.prettyprint.hector.api.Keyspace;
>
> *import* me.prettyprint.hector.api.beans.HColumn;
>
> *import* me.prettyprint.hector.api.exceptions.HectorException;
>
> *import* me.prettyprint.hector.api.factory.HFactory;
>
> *import* me.prettyprint.hector.api.mutation.Mutator;
>
> *import* me.prettyprint.hector.api.query.ColumnQuery;
>
> *import* me.prettyprint.hector.api.query.QueryResult;
>
>
>
> *public* *class* InsertSingleColumn {
>
> *private* *static* StringSerializer *stringSerializer* = StringSerializer.
> *get*();
>
>
>
>     *public* *static* *void* main(String[] args) *throws* Exception {
>
>         Cluster cluster = HFactory.*getOrCreateCluster*("TestCluster",
> "*.*.*.*:9160");
>
>
>
>         Keyspace keyspaceOperator = HFactory.*createKeyspace*("Shandy",
> cluster);
>
>
>
>         *try* {
>
>             Mutator<String> mutator = 
> HFactory.*createMutator*(keyspaceOperator,
> StringSerializer.*get*());
>
>             mutator.insert("jsmith", "Standard1", HFactory.*
> createStringColumn*("first", "John"));
>
>
>
>             ColumnQuery<String, String, String> columnQuery = HFactory.*
> createStringColumnQuery*(keyspaceOperator);
>
>
> columnQuery.setColumnFamily("Standard1").setKey("jsmith").setName("first");
>
>             QueryResult<HColumn<String, String>> result =
> columnQuery.execute();
>
>
>
>             System.*out*.println("Read HColumn from cassandra: " +
> result.get());
>
>             System.*out*.println("Verify on CLI with:  get
> Keyspace1.Standard1['jsmith'] ");
>
>
>
>         } *catch* (HectorException e) {
>
>             e.printStackTrace();
>
>         }
>
>         cluster.getConnectionManager().shutdown();
>
>     }
>
>
>
> }
>
>
>
> And it shows the error :
>
>
>
> *me.prettyprint.hector.api.exceptions.HInvalidRequestException*:
> InvalidRequestException(why:unconfigured columnfamily Standard1)
>
>       at
> me.prettyprint.cassandra.service.ExceptionsTranslatorImpl.translate(*
> ExceptionsTranslatorImpl.java:42*)
>
>       at me.prettyprint.cassandra.service.KeyspaceServiceImpl$1.execute(*
> KeyspaceServiceImpl.java:95*)
>
>       at me.prettyprint.cassandra.service.KeyspaceServiceImpl$1.execute(*
> KeyspaceServiceImpl.java:88*)
>
>       at me.prettyprint.cassandra.service.Operation.executeAndSetResult(*
> Operation.java:89*)
>
>       at
> me.prettyprint.cassandra.connection.HConnectionManager.operateWithFailover(
> *HConnectionManager.java:142*)
>
>       at
> me.prettyprint.cassandra.service.KeyspaceServiceImpl.operateWithFailover(*
> KeyspaceServiceImpl.java:129*)
>
>       at me.prettyprint.cassandra.service.KeyspaceServiceImpl.batchMutate(
> *KeyspaceServiceImpl.java:100*)
>
>       at me.prettyprint.cassandra.service.KeyspaceServiceImpl.batchMutate(
> *KeyspaceServiceImpl.java:106*)
>
>       at me.prettyprint.cassandra.model.MutatorImpl$2.doInKeyspace(*
> MutatorImpl.java:149*)
>
>       at me.prettyprint.cassandra.model.MutatorImpl$2.doInKeyspace(*
> MutatorImpl.java:146*)
>
>       at
> me.prettyprint.cassandra.model.KeyspaceOperationCallback.doInKeyspaceAndMeasure(
> *KeyspaceOperationCallback.java:20*)
>
>      at me.prettyprint.cassandra.model.ExecutingKeyspace.doExecute(*
> ExecutingKeyspace.java:65*)
>
>       at me.prettyprint.cassandra.model.MutatorImpl.execute(*
> MutatorImpl.java:146*)
>
>       at me.prettyprint.cassandra.model.MutatorImpl.insert(*
> MutatorImpl.java:55*)
>
>       at com.riptano.cassandra.hector.example.InsertSingleColumn.main(*
> InsertSingleColumn.java:21*)
>
> Caused by: InvalidRequestException(why:unconfigured columnfamily Standard1)
>
>       at org.apache.cassandra.thrift.Cassandra$batch_mutate_result.read(*
> Cassandra.java:16477*)
>
>       at org.apache.cassandra.thrift.Cassandra$Client.recv_batch_mutate(*
> Cassandra.java:916*)
>
>       at org.apache.cassandra.thrift.Cassandra$Client.batch_mutate(*
> Cassandra.java:890*)
>
>       at me.prettyprint.cassandra.service.KeyspaceServiceImpl$1.execute(*
> KeyspaceServiceImpl.java:93*)
>
>       ... 13 more
>
>
>
>
>
> 华为技术有限公司 Huawei Technologies Co., Ltd.[image: Company_logo]
>
>
>
>
>
>
>
> Phone: 28358610
> Mobile: 13425182943
> Email: raoyix...@huawei.com
> 地址:深圳市龙岗区坂田华为基地 邮编:518129
> Huawei Technologies Co., Ltd.
> Bantian, Longgang District,Shenzhen 518129, P.R.China
> http://www.huawei.com
>  ------------------------------
>
> 本邮件及其附件含有华为公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁
> 止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中
> 的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!
> This e-mail and its attachments contain confidential information from
> HUAWEI, which
> is intended only for the person or entity whose address is listed above.
> Any use of the
> information contained herein in any way (including, but not limited to,
> total or partial
> disclosure, reproduction, or dissemination) by persons other than the
> intended
> recipient(s) is prohibited. If you receive this e-mail in error, please
> notify the sender by
> phone or email immediately and delete it!
>
>
>



-- 
thanks
ashish

Blog: http://www.ashishpaliwal.com/blog
My Photo Galleries: http://www.pbase.com/ashishpaliwal

Reply via email to