You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by mvolkomorov <22...@gmail.com> on 2021/02/05 14:16:51 UTC
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/
Re: CacheJdbcBlobStoreFactory Failed to load bean in application context
Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!
I'm not entirely sure why this happens post 2.8:
https://issues.apache.org/jira/browse/IGNITE-1903
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 <22...@gmail.com>:
> 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/
>
Re: CacheJdbcBlobStoreFactory Failed to load bean in application
context
Posted by mvolkomorov <22...@gmail.com>.
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/