I am running an application written in Scala that is using Spark, Ignite,
and persisting from writeThrough cache to Cassandra. From the Ignite base
concepts code you are supposed to set the CacheStoreFactory as such:

<property name="cacheStoreFactory">
    <bean 
class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
        <!-- Datasource configuration bean which is responsible for
Cassandra connection details -->
        <property name="dataSourceBean" value="cassandraDataSource"/>
        <!-- Persistent settings bean which is responsible for the
details of how objects will be persisted to Cassandra -->
        <property name="persistenceSettingsBean"
value="cache1_persistence_settings"/>
    </bean></property>

Yet, when I run the application I get the error:

java.lang.IllegalStateException:
Failed to get Cassandra DataSource cause Spring application context wasn't
injected into CassandraCacheStoreFactory

All of the Ignite.xml, connection-settings.xml and cassandra-store.xml are
all written the same way as the examples explain on apacheignite Cassandra
integration page.

I am initializing the CassandraCacheStoreFactory as follows:

val cassandraDataSource = new DataSource
cassandraDataSource.setContactPoints("prod-cassandra-db.ct.corp")
val robinPolicy = new RoundRobinPolicy
cassandraDataSource.setLoadBalancingPolicy(robinPolicy)
cassandraDataSource.setReadConsistency("ONE")
cassandraDataSource.setWriteConsistency("ONE")

val CONFIG = "src/main/resources/default-cassandra-store.xml"
val persistenceSettings = new KeyValuePersistenceSettings(CONFIG)
val cassandraCacheStoreFactory = new CassandraCacheStoreFactory
cassandraCacheStoreFactory.setDataSource(cassandraDataSource)
cassandraCacheStoreFactory.setPersistenceSettings(persistenceSettings)

And I am starting the Ignite code as follows:

val igniteContext = new IgniteContext(sparkContext, config.igniteConfig,
true)
val ignite = igniteContext.ignite()

What am I missing or doing wrong that is causing this error? I have yet to
find a simple, comprehensive example in Scala for doing this.

Reply via email to