Search code examples
apache-sparkignitespark-structured-streaming

Ignite connection failing with Spark Structured streaming


I'm trying to integrate ignite to my spark structured streaming application.
Following are the dependencies I included for ignite
- ignite-core,
- ignite-spark,
- ignite-spring,
- cache-api

Spark config for ignite

private static final String CONFIG = "C:\\apache-ignite-2.7.6-bin\\config\\default-config.xml";
spark.read().format(IgniteDataFrameSettings.FORMAT_IGNITE())
.option(IgniteDataFrameSettings.OPTION_CONFIG_FILE(), CONFIG)
.option(IgniteDataFrameSettings.OPTION_TABLE(), "person")
.load();

Totally clueless on how to resolve the below error, as the config is the default config provided in the binary. All the dependencies are included.
- Ignite 2.7.6
- Spark 2.4.0

 ERROR StpMain: Error
class org.apache.ignite.IgniteException: Failed to instantiate Spring XML application context [springUrl=file:/C:/apache-ignite-2.7.6-bin/config/default-config.xml, err=Line 26 in XML document from URL [file:/C:/apache-ignite-2.7.6-bin/config/default-config.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 26; columnNumber: 72; cvc-elt.1: Cannot find the declaration of element 'beans'.]

default-config.xml

<?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">

    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
        <property name="cacheConfiguration">
            <!-- SharedRDD cache example configuration (Atomic mode). -->
            <bean class="org.apache.ignite.configuration.CacheConfiguration">
                <!-- Set a cache name. -->
                <property name="name" value="sharedRDD"/>
                <!-- Set a cache mode. -->
                <property name="cacheMode" value="PARTITIONED"/>
                <!-- Index Integer pairs used in the example. -->
                <property name="indexedTypes">
                    <list>
                        <value>java.lang.Integer</value>
                        <value>java.lang.Integer</value>
                    </list>
                </property>
                <!-- Set atomicity mode. -->
                <property name="atomicityMode" value="ATOMIC"/>
                <!-- Configure a number of backups. -->
                <property name="backups" value="1"/>
            </bean>
        </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>localhost:10800</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>
</beans>

Solution

  • Should also comment that the Spark 2.4 is not supported yet.

    Here is the ticket on Apache Ignite JIRA, you could track the status here https://issues.apache.org/jira/browse/IGNITE-12054