Search code examples
kubernetesclientignitegridgainnear-cache

GridGain client on K8s fails with error java.lang.NoSuchMethodError: org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO.registerH2


We are trying to integrate GridGain into an existing client java based application to create a Thick GG client, for the purpose of in memory caching and to implement a near cache. We have a Kubernetes cluster onto which the main GridGain server is already deployed and is up and running, we have not setup for any persistence, this is purely in memory. When I deploy the Client App configured with GridGain I get the following message within the logs ~

2022-11-30 09:32:08,846 [:/EXECUTING(38)=null] CRIT com.<ourAppName>.agent.StorageInstall - fail to install
java.lang.NoSuchMethodError: org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO.registerH2(Lorg/apache/ignite/internal/processors/cache/persistence/tree/io/IOVersions;Lorg/apache/ignite/internal/processors/cache/persistence/tree/io/IOVersions;Lorg/apache/ignite/internal/processors/cache/persistence/tree/io/IOVersions;Lorg/apache/ignite/internal/processors/cache/persistence/tree/io/IOVersions;)V
        at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.<clinit>(IgniteH2Indexing.java:264)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at org.apache.ignite.internal.IgniteComponentType.inClassPath(IgniteComponentType.java:153)
        at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:1906)
        at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1716)
        at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1144)
        at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:664)
        at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:589)
        at org.apache.ignite.Ignition.start(Ignition.java:322)
        ...
        at com.<ourAppName>.framework.xhome.pipe.ThreadPool$PooledThread.run(ThreadPool.java:131)

These dependencies have been included in our gradle build for the client application ~

    // Ignite
    def igniteVersion = '8.8.22'
    compile group: 'org.gridgain', name: 'ignite-core', version: igniteVersion
    compile group: 'org.gridgain', name: 'ignite-spring', version: igniteVersion
    compile group: 'org.gridgain', name: 'ignite-indexing', version: igniteVersion
    compile group: 'org.gridgain', name: 'ignite-h2', version: igniteVersion
    compile group: 'org.apache.ignite',name: 'ignite-kubernetes', version: '2.4.0'

I wasn't sure on the Kubernetes one, I think it is required to be passed to the TcpDiscoverySpi, one version of our code looked like this ~

        IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setClientMode(true);


        CacheConfiguration<Object, Object> cacheCfg = new CacheConfiguration<Object, Object>();
        cacheCfg.setName(cacheName);
        // Create a near/underlying cache configuration
            NearCacheConfiguration<Object, Object> nearCfg = new NearCacheConfiguration<>();
                nearCfg.setNearEvictionPolicyFactory(new LruEvictionPolicyFactory<>(100_000));
        cacheCfg.setNearConfiguration(nearCfg);

        cfg.setCacheConfiguration(cacheCfg);

        //Setup Kubernetes discovery
        TcpDiscoverySpi spi = new TcpDiscoverySpi();
        TcpDiscoveryKubernetesIpFinder ipFinder = new TcpDiscoveryKubernetesIpFinder();
        ipFinder.setNamespace("gridgain");
        ipFinder.setServiceName("gridgain-service");
        spi.setIpFinder(ipFinder);

        //Set discovery in the IgniteConfiguration cfg
        cfg.setDiscoverySpi(spi);

    Ignite ignite = Ignition.start(cfg))

The client fails to start correctly throwing the H2 indexing error above on Ignition.start() and our main ignite server never registers the client as having connected. We have configured our main ignite server as follows and setup the other required components e.g. namespace, service-name, cluster name etc ~

<?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 class="org.apache.ignite.configuration.IgniteConfiguration">

        <property name="discoverySpi">
            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="ipFinder">
                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.kubernetes.TcpDiscoveryKubernetesIpFinder">
                        <property name="namespace" value="gridgain"/>
                        <property name="serviceName" value="gridgain-service"/>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>
</beans>

I tried adding the Indexing dependencies as I thought this might be causing the issue and wrote the code a few different ways, but nothing seems to make a difference.

Let me know if you need me to provide any further info, at the time of writing we are using the latest version of GridGain 8.8.22 with the exception of the ignite-kubernetes as mentioned above as I could not find that file online.

As we're not trying to persist data and and have not included DataStorageConfiguration anywhere I am unsure why we are seeing this issue, any thoughts? To me it seems like this error is related to persistence /data indexing, where is it getting it from though?

Thanks, N


Solution

  • We got this resolved by tidying up our dependencies, as we are working the the GridGain Community Edition 8.8.22 and really only need the core dependencies we changed ours to ~

    def igniteVersion = '8.8.22'
    
    // Ignite
    compile group: 'org.gridgain', name: 'ignite-core', version: igniteVersion
    compile group: 'org.gridgain', name: 'ignite-spring', version: igniteVersion
    compile group: 'org.gridgain', name: 'ignite-indexing', version: igniteVersion
    compile group: 'org.gridgain', name: 'ignite-h2', version: igniteVersion
    compile group: 'org.gridgain', name: 'ignite-kubernetes', version: igniteVersion
    

    We previously had the gridgain-ultimate dependency included as well, it may have been causing the conflict and really shouldn't have been in there as we are using the CE.

    Thanks, LS