0
votes

I am trying to connect to a Apache Ignite Server from a Spring Boot Application.

Example code:

ClientConfiguration cfg = new ClientConfiguration().setAddresses("127.0.0.1:10800");
try (IgniteClient client = Ignition.startClient(cfg)) {
    Object cachedName = client.query(
            new SqlFieldsQuery("SELECT name from Person WHERE id=?").setArgs("foo").setSchema("PUBLIC")
    ).getAll().iterator().next().iterator().next();
}

I get this error:

Caused by: class org.apache.ignite.IgniteCheckedException: Remote node has peer class loading enabled flag different from local [locId8=459833a1, locPeerClassLoading=true, rmtId8=83ea88ca, rmtPeerClassLoading=false, rmtAddrs=[ignite-0.ignite.default.svc.cluster.local/0:0:0:0:0:0:0:1%lo, /10.4.2.49, /127.0.0.1], rmtNode=ClusterNode [id=83ea88ca-da77-4887-9357-267ac7397767, order=1, addr=[0:0:0:0:0:0:0:1%lo, 10.x.x.x, 127.0.0.1], daemon=false]]

So the PeerClassLoading needs to be deactivated in my Java code. How can I do that?

1
The example code is connecting a thin client to Ignite (which does not support peer-class loading). The error is from a thick client, so this does not make sense to me. Are you sure this is the code causing the error?Stephen Darlington
This is strange. Yes the code above is the only part that I used. Is my overall approach correct? I have a one node ignite cluster, that I want to connect to from my services. Should I not be using the thin client?Alex Tbk
The exception you shared is from a thick client (a client node which joins your cluster). Thick client is configured by IgniteConfiguration (could be an *.xml file or java config - look for org.apache.ignite.configuration.IgniteConfiguration usage in your project). The code you provided is for thin client which just builds a connection with one server node and has limited functionality in comparison with thick client. I'd stay with thin client if its cover all your use cases. If not, find your thick client config and set peerClassLoadingEnabled to true in IgniteConfiguration.Max
To false. It is false on server so it should be false on client too.alamar

1 Answers

0
votes

As noted in the comments, the error is from a thick client (or another server) connecting to the cluster but the code is from a thin client.

If you’re just reading/writing data and don’t need to execute code, the thin client is a perfectly good option.

To use a thick client, you need to make sure both the thick client and server have the same peer-class loading configuration. That would be either:

<property name=“peerClassLoadingEnabled” value=“false” />

in your Spring configuration file. Or:

IgniteConfiguration cfg = new IgniteConfiguration()
            ...
            .setPeerClassLoadingEnabled(false);

(I’ve used false here as that’s your current server configuration. Having said that, you probably want it to be switched on.)