CacheJdbcBlobStoreFactory Failed to load bean in application context

classic Classic list List threaded Threaded
3 messages Options
mvolkomorov mvolkomorov
Reply | Threaded
Open this post in threaded view
|

CacheJdbcBlobStoreFactory Failed to load bean in application context

Hello!

Is it correct to start 2 nodes at single jvm using IgniteSpring#start?

Trying to use cacheStore with h2 database at junit test, i am starting two
nodes same time:

ApplicationContext dataNodeContext =
                new
ClassPathXmlApplicationContext("file:src/test/resources/data-node.xml");
        IgniteConfiguration igniteDataNodeCfg =
dataNodeContext.getBean(IgniteConfiguration.class);

        igniteDataNodeCfg.setIgniteInstanceName("data-node");
       
        igniteData = IgniteSpring.start(igniteDataNodeCfg, dataNodeContext);

        ApplicationContext serviceContext =
                new
ClassPathXmlApplicationContext("file:src/test/resources/api-node.xml");
        IgniteConfiguration igniteServiceNodeCfg =
serviceContext.getBean(IgniteConfiguration.class);

        igniteServiceNodeCfg.setIgniteInstanceName("api-node");

        igniteService = IgniteSpring.start(igniteServiceNodeCfg,
serviceContext);

data-node.xml:

    <bean id="h2DataSource" class="org.h2.jdbcx.JdbcDataSource">
        <property name="url" value="jdbc:h2:mem:testdb"/>
        <property name="user" value="sa"/>
        <property name="password" value=""/>
    </bean>

<bean class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="myCache"/>
                    <property name="cacheStoreFactory">
                        <bean
class="org.apache.ignite.cache.store.jdbc.CacheJdbcBlobStoreFactory">
                            <property name="dataSourceBean"
value="h2DataSource" />
                        </bean>
data-node.xml:
               

I am catching IgniteException:

Caused by: class org.apache.ignite.IgniteException: Failed to load bean in
application context [beanName=h2DataSource,
igniteConfig=org.springframework.context.support.GenericApplicationContext@f3021cb:
startup date [Fri Feb 05 16:13:08 MSK 2021]; root of context hierarchy]

at IgniteSpring.start(igniteServiceNodeCfg, serviceContext).

I have no idea why api-node uses h2DataSource bean.
Problem is reproducible only with 2 ignite instances.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
mvolkomorov mvolkomorov
Reply | Threaded
Open this post in threaded view
|

Re: CacheJdbcBlobStoreFactory Failed to load bean in application context

I added     <bean id="h2DataSource" class="org.h2.jdbcx.JdbcDataSource">
        <property name="url" value="jdbc:h2:mem:test;DB_CLOSE_DELAY=-1"/>
        <property name="user" value="sa"/>

    </bean>

to second node (api-node.xml), and it worked.
Does this mean Ignite nodes have a non-isolated application context?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: CacheJdbcBlobStoreFactory Failed to load bean in application context

In reply to this post by mvolkomorov
Hello!

I'm not entirely sure why this happens post 2.8:

Traditionally, we needed to deserialize and initialize all cache stores on all cluster nodes. If the cache is non-transactional, theoretically its cache store is not needed on client and non-affinity nodes. Are you sure that this node fits the description? Can you share a reproducer project?

Regards,
--
Ilya Kasnacheev


пт, 5 февр. 2021 г. в 17:16, mvolkomorov <[hidden email]>:
Hello!

Is it correct to start 2 nodes at single jvm using IgniteSpring#start?

Trying to use cacheStore with h2 database at junit test, i am starting two
nodes same time:

ApplicationContext dataNodeContext =
                new
ClassPathXmlApplicationContext("file:src/test/resources/data-node.xml");
        IgniteConfiguration igniteDataNodeCfg =
dataNodeContext.getBean(IgniteConfiguration.class);

        igniteDataNodeCfg.setIgniteInstanceName("data-node");

        igniteData = IgniteSpring.start(igniteDataNodeCfg, dataNodeContext);

        ApplicationContext serviceContext =
                new
ClassPathXmlApplicationContext("file:src/test/resources/api-node.xml");
        IgniteConfiguration igniteServiceNodeCfg =
serviceContext.getBean(IgniteConfiguration.class);

        igniteServiceNodeCfg.setIgniteInstanceName("api-node");

        igniteService = IgniteSpring.start(igniteServiceNodeCfg,
serviceContext);

data-node.xml:

    <bean id="h2DataSource" class="org.h2.jdbcx.JdbcDataSource">
        <property name="url" value="jdbc:h2:mem:testdb"/>
        <property name="user" value="sa"/>
        <property name="password" value=""/>
    </bean>

<bean class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="myCache"/>
                    <property name="cacheStoreFactory">
                        <bean
class="org.apache.ignite.cache.store.jdbc.CacheJdbcBlobStoreFactory">
                            <property name="dataSourceBean"
value="h2DataSource" />
                        </bean>
data-node.xml:


I am catching IgniteException:

Caused by: class org.apache.ignite.IgniteException: Failed to load bean in
application context [beanName=h2DataSource,
igniteConfig=org.springframework.context.support.GenericApplicationContext@f3021cb:
startup date [Fri Feb 05 16:13:08 MSK 2021]; root of context hierarchy]

at IgniteSpring.start(igniteServiceNodeCfg, serviceContext).

I have no idea why api-node uses h2DataSource bean.
Problem is reproducible only with 2 ignite instances.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/