Ahmad Anwar
Ahmad Anwar

Reputation: 40

Cassandra CREATE CUSTOM INDEX ERROR java.lang.ClassNotFoundException

-> Table :

cassandra@cqlsh:coba> CREATE TABLE data(
        ... nim int,
        ... nama text,
        ... alamat text,
        ... PRIMARY KEY (nim, alamat)
        ... );

-> Make Index :

CREATE CUSTOM INDEX cari_alamat ON coba.data (alamat) USING 'org.apache.cassandra.index.sasi.SASIIndex';

-> Error :

ServerError: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.apache.cassandra.index.sasi.SASIIndex

-> I would be very happy if you can help me

-> Thanks You

Upvotes: 1

Views: 1731

Answers (1)

Marko Švaljek
Marko Švaljek

Reputation: 2101

As initially susspected, I think you are running cassandra version lower than 3.4.

(that's why I asked for the version)

I tried it out and got the same error on 3.0.10:

cqlsh:test> CREATE CUSTOM INDEX cari_alamat ON test.data (alamat) USING 'org.apache.cassandra.index.sasi.SASIIndex';
ConfigurationException: Unable to find custom indexer class 'org.apache.cassandra.index.sasi.SASIIndex'

Theoretically you could implement your own with: Cassandra Custom Secondary Index

But I guess it's just easier to upgrade.

Also be aware there might be some bugs with Sasi indexes:

SASI Indexes in Cassandra seem to have some bugs

But I guess it's better to search cassandra Jira for this one, this is just as a small warning.

Upvotes: 2

Related Questions