You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by ghughal <ba...@gmail.com> on 2016/06/16 18:36:51 UTC
CassandraCacheStoreFactory injection error while trying to use
Cassandra as persistent store
Hi,
I'm trying to use Cassandra as persistent store for my cache. I'm following
example given online but trying to configure CassandraCacheStoreFactory
using java instead of xml. I know there's limitation because of
serialization but just wanted to try it out first. I keep getting exception
"Failed to get Cassandra DataSource cause Spring application context wasn't
injected into CassandraCacheStoreFactory". Is java based config supported
with CassandraCacheStoreFactory? The sample code I see in git is also using
xml based config.
If it's supported, is there anything special I need to be doing? I'm using
ignite version 1.6.0.
Here's complete stack trace:
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/CassandraCacheStoreFactory-injection-error-while-trying-to-use-Cassandra-as-persistent-store-tp5689.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: CassandraCacheStoreFactory injection error while trying to use
Cassandra as persistent store
Posted by vkulichenko <va...@gmail.com>.
Resources including application context are injected in factories as well.
Note that Ignite node has to be started either with Spring configuration
file (Ignition.start("ignite-cfg.xml")) or using IgniteSpringBean:
<bean class="org.apache.ignite.IgniteSpringBean">
<property name="configuration" ref="ignite.cfg"/>
</bean>
-Val
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/CassandraCacheStoreFactory-injection-error-while-trying-to-use-Cassandra-as-persistent-store-tp5689p6244.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: CassandraCacheStoreFactory injection error while trying to use
Cassandra as persistent store
Posted by ghughal <ba...@gmail.com>.
I converted my config to XML and still getting same error ("Failed to get
Cassandra DataSource cause Spring application context wasn't injected into
CassandraCacheStoreFactory").
I looked at SpringApplicationContextResource documentation and it's supposed
to be used within instance of following classes only:
And CassandraCacheStoreFactory implements javax.cache.configuration.Factory
but none of these interfaces.
Not sure if I'm doing something wrong or there's a bug in code.
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/CassandraCacheStoreFactory-injection-error-while-trying-to-use-Cassandra-as-persistent-store-tp5689p6216.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: CassandraCacheStoreFactory injection error while trying to use
Cassandra as persistent store
Posted by ghughal <ba...@gmail.com>.
It looks like I'll have to convert all Ignite and cache configuration to XML.
Just putting cassandra config in XML doesn't seem to work.
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/CassandraCacheStoreFactory-injection-error-while-trying-to-use-Cassandra-as-persistent-store-tp5689p6215.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: CassandraCacheStoreFactory injection error while trying to use
Cassandra as persistent store
Posted by vkulichenko <va...@gmail.com>.
Hi,
You can define the DataSource as a separate Spring bean in the XML
configuration file (outside of IgniteConfiguration) and refer to it via
'dataSourceBean' property in cache store factory. See the first example in
[1].
[1] https://apacheignite.readme.io/docs/base-concepts
-Val
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/CassandraCacheStoreFactory-injection-error-while-trying-to-use-Cassandra-as-persistent-store-tp5689p6193.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: CassandraCacheStoreFactory injection error while trying to use
Cassandra as persistent store
Posted by ghughal <ba...@gmail.com>.
Is this issue related to this defect:
https://issues.apache.org/jira/browse/IGNITE-3314
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/CassandraCacheStoreFactory-injection-error-while-trying-to-use-Cassandra-as-persistent-store-tp5689p6183.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: CassandraCacheStoreFactory injection error while trying to use
Cassandra as persistent store
Posted by ghughal <ba...@gmail.com>.
Hi,
This was working fine in single node cluster but got into same error once I
started second node in cluster.
Debugging it further, it looks like when we initialize Ignite object (using
Ignite ignite = Ignition.start(ic);) it detects all cache store settings
from other node and tries to initialize cache using persistanceSetting
probably received from other node. But at this moment dataSource is null and
cache is not initialized
<http://apache-ignite-users.70518.x6.nabble.com/file/n6176/Screen_Shot_2016-07-08_at_10.png>
Here's stack trace:
Any help in this regard is much appreciated. Thanks!
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/CassandraCacheStoreFactory-injection-error-while-trying-to-use-Cassandra-as-persistent-store-tp5689p6176.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: CassandraCacheStoreFactory injection error while trying to use
Cassandra as persistent store
Posted by ghughal <ba...@gmail.com>.
Thanks Denis. I was initializing data source using setDataSource() but the
problem was with the bean I was using to initialize setDataSource() with.
Issue is resolved about fixing that bean.
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/CassandraCacheStoreFactory-injection-error-while-trying-to-use-Cassandra-as-persistent-store-tp5689p5764.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: CassandraCacheStoreFactory injection error while trying to use Cassandra as persistent store
Posted by Denis Magda <dm...@gridgain.com>.
Hi,
If you want to initialize CassandraCacheStoreFactory programmatically you need initialize the following on Java side as well:
- CassandraCacheStoreFactory.setDataSource(DataSource dataSrc)
- CassandraCacheStoreFactory.setPersistenceSettings(KeyValuePersistenceSettings settings)
DataSource and the settings are constructed in Spring XML as beans by default. You just need to initialize them on Java side.
—
Denis
> On Jun 16, 2016, at 9:36 PM, ghughal <ba...@gmail.com> wrote:
>
> Hi,
>
> I'm trying to use Cassandra as persistent store for my cache. I'm following
> example given online but trying to configure CassandraCacheStoreFactory
> using java instead of xml. I know there's limitation because of
> serialization but just wanted to try it out first. I keep getting exception
> "Failed to get Cassandra DataSource cause Spring application context wasn't
> injected into CassandraCacheStoreFactory". Is java based config supported
> with CassandraCacheStoreFactory? The sample code I see in git is also using
> xml based config.
>
> If it's supported, is there anything special I need to be doing? I'm using
> ignite version 1.6.0.
>
> Here's complete stack trace:
>
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/CassandraCacheStoreFactory-injection-error-while-trying-to-use-Cassandra-as-persistent-store-tp5689.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.