0

I can not integrate cassandra with ignite. I tried many methods but none of them worked.

I added the optional libraries to lib folder. But no result. When I tried the example1 provided in the ignite document, Then I got the classpath error.

I am using ignite version 2.6 and cassandra version 3.11.4

This is my config file

    <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd">

    <!-- Cassandra connection settings -->
    <import resource="classpath:org/apache/ignite/tests/cassandra/connection-settings.xml" />

    <!-- Persistence settings for 'cache1' -->
    <bean id="cache1_persistence_settings" class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings">
        <constructor-arg type="org.springframework.core.io.Resource" value="classpath:org/apache/ignite/tests/persistence/blob/persistence-settings-1.xml" />
    </bean>

    <!-- Persistence settings for 'cache2' -->
    <bean id="cache2_persistence_settings" class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings">
        <constructor-arg type="org.springframework.core.io.Resource" value="classpath:org/apache/ignite/tests/persistence/blob/persistence-settings-3.xml" />
    </bean>

    <!-- Ignite configuration -->
    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
        <property name="cacheConfiguration">
            <list>
                <!-- Configuring persistence for "cache1" cache -->
                <bean class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="cache1"/>
                    <property name="readThrough" value="true"/>
                    <property name="writeThrough" value="true"/>
                    <property name="cacheStoreFactory">
                        <bean class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
                            <property name="dataSourceBean" value="cassandraAdminDataSource"/>
                            <property name="persistenceSettingsBean" value="cache1_persistence_settings"/>
                        </bean>
                    </property>
                </bean>

                <!-- Configuring persistence for "cache2" cache -->
                <bean class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="cache2"/>
                    <property name="readThrough" value="true"/>
                    <property name="writeThrough" value="true"/>
                    <property name="cacheStoreFactory">
                        <bean class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
                            <property name="dataSourceBean" value="cassandraAdminDataSource"/>
                            <property name="persistenceSettingsBean" value="cache2_persistence_settings"/>
                        </bean>
                    </property>
                </bean>
            </list>
        </property>

        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
        <property name="discoverySpi">
            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="ipFinder">
                    <!--
                        Ignite provides several options for automatic discovery that can be used
                        instead os static IP based discovery. For information on all options refer
                        to our documentation: http://apacheignite.readme.io/docs/cluster-config
                    -->
                    <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
                    <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
                        <property name="addresses">
                            <list>
                                <!-- In distributed environment, replace with actual host IP address. -->
                                <value>127.0.0.1:47500..47509</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>
</beans>

Error Message is

 bin/ignite.sh /etc/ignite/config/config1.xml 
    class org.apache.ignite.IgniteException: Failed to instantiate Spring XML application context [springUrl=file:/etc/ignite/config/config1.xml, err=Configuration problem:
 Failed to import bean definitions from URL location [classpath:org/apache/ignite/tests/cassandra/connection-settings.xml]
    Offending resource: URL [file:/etc/ignite/config/config1.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [org/apache/ignite/tests/cassandra/connection-settings.xml]; nested exception is java.io.FileNotFoundException: class path resource [org/apache/ignite/tests/cassandra/connection-settings.xml] cannot be opened because it does not exist]
        at org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:990)
        at org.apache.ignite.Ignition.start(Ignition.java:355)
        at org.apache.ignite.startup.cmdline.CommandLineStartup.main(CommandLineStartup.java:301)
    Caused by: class org.apache.ignite.IgniteCheckedException: Failed to instantiate Spring XML application context [springUrl=file:/etc/ignite/config/config1.xml, err=Configuration problem: Failed to import bean definitions from URL location [classpath:org/apache/ignite/tests/cassandra/connection-settings.xml]
    Offending resource: URL [file:/etc/ignite/config/config1.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [org/apache/ignite/tests/cassandra/connection-settings.xml]; nested exception is java.io.FileNotFoundException: class path resource [org/apache/ignite/tests/cassandra/connection-settings.xml] cannot be opened because it does not exist]
        at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.applicationContext(IgniteSpringHelperImpl.java:392)
        at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:104)
        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)
        ... 1 more
    Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:org/apache/ignite/tests/cassandra/connection-settings.xml]
    Offending resource: URL [file:/etc/ignite/config/config1.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [org/apache/ignite/tests/cassandra/connection-settings.xml]; nested exception is java.io.FileNotFoundException: class path resource [org/apache/ignite/tests/cassandra/connection-settings.xml] cannot be opened because it does not exist
        at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
        at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:118)
        at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:103)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:233)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:184)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:169)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:142)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:94)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:508)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
        at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.applicationContext(IgniteSpringHelperImpl.java:379)
        ... 9 more
    Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [org/apache/ignite/tests/cassandra/connection-settings.xml]; nested exception is java.io.FileNotFoundException: class path resource [org/apache/ignite/tests/cassandra/connection-settings.xml] cannot be opened because it does not exist
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:344)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:227)
        ... 18 more
    Caused by: java.io.FileNotFoundException: class path resource [org/apache/ignite/tests/cassandra/connection-settings.xml] cannot be opened because it does not exist
        at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:330)
        ... 22 more
    Failed to start grid: Failed to instantiate Spring XML application context [springUrl=file:/etc/ignite/config/config1.xml, err=Configuration problem: Failed to import bean definitions from URL location [classpath:org/apache/ignite/tests/cassandra/connection-settings.xml]
    Offending resource: URL [file:/etc/ignite/config/config1.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [org/apache/ignite/tests/cassandra/connection-settings.xml]; nested exception is java.io.FileNotFoundException: class path resource [org/apache/ignite/tests/cassandra/connection-settings.xml] cannot be opened because it does not exist]
Ashok v
  • 77
  • 1
  • 8

1 Answers1

1

This is not a classpath error. Spring reports, that there is no bean called cassandraDataSource. Judging by the comment in your configuration file <!-- Cassandra connection settings --> and no bean definitions under it, looks like you removed the corresponding configuration part.

So, you need to configure the data source for Cassandra. You can refer to the documentation for more details: https://apacheignite-mix.readme.io/docs/ignite-with-apache-cassandra

Configuration examples: https://apacheignite-mix.readme.io/docs/examples

Denis
  • 3,573
  • 8
  • 13
  • Hi I edited the file . But I got the FileNotFound Exception.How to solve this issue. I am using Ignite first time – Ashok v Jul 06 '19 at 15:26
  • It means that you specified an import directive, but you don't have a corresponding file on the classpath. It's supposed to be a data source bean there. Take a look at the contents of `connection-settings.xml ` on the examples page: https://apacheignite-mix.readme.io/docs/examples – Denis Jul 08 '19 at 17:38
  • I solved it by specifying correct path, Now this is my new issue https://stackoverflow.com/questions/56933378/failed-to-execute-cassandra-cql-statement-while-reading-from-ignite-cache?noredirect=1#comment100416384_56933378 – Ashok v Jul 09 '19 at 03:42