I want to use ignite as cache api as well as spring cache provider. I am
running following configuration in ignite-config.xml file as below

<beans xmlns="http://www.springframework.org/schema/beans";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xmlns:cache="http://www.springframework.org/schema/cache";
   xsi:schemaLocation="http://www.springframework.org/schema/beans
                       
http://www.springframework.org/schema/beans/spring-beans.xsd
                        http://www.springframework.org/schema/cache
                       
http://www.springframework.org/schema/cache/spring-cache.xsd";
                        >




<bean class="org.apache.ignite.configuration.IgniteConfiguration">
  <property name="peerClassLoadingEnabled" value="true"/>
  <property name="igniteInstanceName" value="claimgrid"/>
<property name="cacheConfiguration">
                <list>
                    <bean
class="org.apache.ignite.configuration.CacheConfiguration">

                        <property name="name"
value="T_MST_TEUC_Q_PERCENTAGE"/>
                        <property name="cacheMode" value="REPLICATED"/>
                        <property name="atomicityMode" value="ATOMIC"/>
                        <property name="partitionLossPolicy"
value="READ_WRITE_SAFE"/>
                        <property name="backups" value="0"/>
                        <property name="groupName" value="masterData"/>
                        <property name="cacheStoreFactory">
                            <bean
class="javax.cache.configuration.FactoryBuilder" factory-method="factoryOf">
                                <constructor-arg
value="com.mrm.access.benefits.ms.claim.cache.store.SequesterPercentageModelStore"/>
                            </bean>

                        </property>

                        <property name="readThrough" value="true"/>
                        <property name="writeThrough" value="true"/>

                    </bean>
</list>
</property>



    <property name="discoverySpi">
        <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
            <property name="ipFinder">
                <bean
class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                 <property name="addresses">
                        <list>  
                              <value>10.80.211.76</value>
                        </list>
                    </property>
                    </bean>
            </property>
        </bean>
    </property>
</bean>


I want to use ignite as cache api as well as spring cache provider. I am
running following configuration in ignite-config.xml file as below

<beans xmlns="http://www.springframework.org/schema/beans";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xmlns:cache="http://www.springframework.org/schema/cache";
   xsi:schemaLocation="http://www.springframework.org/schema/beans
                       
http://www.springframework.org/schema/beans/spring-beans.xsd
                        http://www.springframework.org/schema/cache
                       
http://www.springframework.org/schema/cache/spring-cache.xsd";
                        >




<bean class="org.apache.ignite.configuration.IgniteConfiguration">
  <property name="peerClassLoadingEnabled" value="true"/>
  <property name="igniteInstanceName" value="claimgrid"/>
<property name="cacheConfiguration">
                <list>
                    <bean
class="org.apache.ignite.configuration.CacheConfiguration">

                        <property name="name"
value="T_MST_TEUC_Q_PERCENTAGE"/>
                        <property name="cacheMode" value="REPLICATED"/>
                        <property name="atomicityMode" value="ATOMIC"/>
                        <property name="partitionLossPolicy"
value="READ_WRITE_SAFE"/>
                        <property name="backups" value="0"/>
                        <property name="groupName" value="masterData"/>
                        <property name="cacheStoreFactory">
                            <bean
class="javax.cache.configuration.FactoryBuilder" factory-method="factoryOf">
                                <constructor-arg
value="com.mrm.access.benefits.ms.claim.cache.store.SequesterPercentageModelStore"/>
                            </bean>

                        </property>

                        <property name="readThrough" value="true"/>
                        <property name="writeThrough" value="true"/>

                    </bean>
</list>
</property>



    <property name="discoverySpi">
        <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
            <property name="ipFinder">
                <bean
class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                 <property name="addresses">
                        <list>  
                              <value>10.80.211.76</value>
                        </list>
                    </property>
                    </bean>
            </property>
        </bean>
    </property>
</bean>
I am initializing the ignite node as below.

ApplicationContext context= SpringApplication.run(Application.class, args);
Ignite ignite=IgniteSpring.start("ignite-config.xml", context);

The node gets up and running. Now I am using second configuration file for
spring cache manager spring-cache.xml


<beans xmlns="http://www.springframework.org/schema/beans";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xmlns:cache="http://www.springframework.org/schema/cache";
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                           
http://www.springframework.org/schema/beans/spring-beans.xsd
                            http://www.springframework.org/schema/cache
                                                
http://www.springframework.org/schema/cache/spring-cache.xsd";
                            >
<bean id="cacheManager"
class="org.apache.ignite.cache.spring.SpringCacheManager">
        
 
                <property name="igniteInstanceName" value="claimgrid" />

 
    </bean>
    <cache:annotation-driven/>
</beans>


and I am initializing this file as below

Ignite ignite=Ignition.start("spring-cache.xml");

I am getting the below exception

Caused by: class org.apache.ignite.IgniteCheckedException: Failed to find
configuration in: file:/E:/Workspace/ms.claim/spring-cache.xml at
org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:116)
at
org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:98)
at
org.apache.ignite.internal.IgnitionEx.loadConfigurations(IgnitionEx.java:744)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:945) at
org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:854) at
org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:724) at
org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:693) at
org.apache.ignite.Ignition.start(Ignition.java:352) ... 2 more

While debugging the ignite source code I found that ignite internally uses
SpringHelper to get the Spring Application Context and after that it tries
to fetch IgniteConfiguration instance as spring bean using getBeansOfType()
method in one of the classes and from there it does not get the
configuration instance and throws the above exception.

As mentioned in the Ignite documentation I am using the same gridName or
instanceName property in SpringCacheManager in spring-cache.xml.

Can somebody please check the issue? Also I am not sure I am following the
correct method. First I am staring the ignite node with ignite-config.xml
and IgniteSpring.start and once a node is up I am initializing
spring-cache.xml with Ignition.start to configure Ignite as
SpringCacheManager.



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

Reply via email to