Jason,

Thanks for tips,

I found that CacheJdbcPojoStoreFactory required to have bean specified at
 <property name="*dataSourceBean*" value="dataSource"/>
inside client config to use this cache.

Another way is to specify *dataSource *property instead.

for example:

<bean id="storeDataSource"
class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore">
    <property name="dataSource">
        <bean class="org.h2.jdbcx.JdbcConnectionPool" factory-method="create">
            <constructor-arg value="jdbc:h2:tcp://0.0.0.0/mem:db"/>
            <constructor-arg value="sa"/>
            <constructor-arg value=""/>
        </bean>
    </property>
</bean>

Here's the code explaining how it works:

if (dataSrc != null) // Use this case.
    store.setDataSource(dataSrc);
else {
    if (dataSrcBean != null) {
        if (appCtx == null)
            throw new IgniteException("Spring application context
resource is not injected.");

        IgniteSpringHelper spring;

        try {
            spring = IgniteComponentType.SPRING.create(false);

            DataSource data = spring.loadBeanFromAppContext(appCtx,
dataSrcBean);

            store.setDataSource(data);

Let me know in case it will not help.

On Wed, Sep 21, 2016 at 9:57 AM, amdam23000 <629160...@qq.com> wrote:

> Hi Anton,
>
> I'm sorry that for some reason i can't copy stack trace to text file out of
> the box.
> The more detail about the exception is as below:
>
> at
> org.apache.ignite.internal.processors.cache.distributed.dht.preloader.
> GridDhtPartitionsExchangeFuture.startCaches(GridDhtPartitionsExchangeFutur
> e.java:956)
> at
> org.apache.ignite.internal.processors.cache.distributed.dht.preloader.
> GridDhtPartitionsExchangeFuture.init(GridDhtPartitionsExchangeFutur
> e.java:523)
> at
> org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeMana
> ger$ExchangeWorker.body(GridCachePartitionExchangeManager.java:1297)
> at
> org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
>
> The ignite version i use is 1.5.0, please notice this.
>
> I debug a little and find that client side will first receive cache config
> from server side,
> and then client will try to create an instance of that cache
> store(cfg.getCacheStoreFactory().create()).
> During the process of the instance creation, "datasource" cannot been found
> locally so error occurs.
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Data-grid-client-errors-out-when-
> datasource-not-defined-tp7820p7852.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Reply via email to