0

For integration testing, I have spun up an ignite client inside a docker test container to which I connect with an ignite thin client. I then create a test cache by calling getOrCreateCache and store the reference to it. However, when I try to call cache.put(key, value), it gives me a ClientConnectionException saying that the ignite cluster is unavailable error.

The ClientConnectionException I get.

Finally, at the very end of my testing, I have an @AfterClass which destroys the test cache. However, that line also gives me an ignite cluster is unavailable error.

I first thought that the issue was that my cluster might not have been activated. I tried to fix that by trying to activating the cluster through both code, and also through a terminal when execution is paused. However, that has not fixed my issue.

Before I try to put the value in the cache, I even print out all the caches and the cache seems to have been created and I seem to have a reference to it when I look through the debugger.

Initial container setup


 igniteServerContainer =
        new GenericContainer("apacheignite/ignite:2.5.0")
            .withNetwork(network)
            .withNetworkAliases("ignite")
            .withExposedPorts(10800);

    igniteServerContainer.start();

      igniteServerContainer.execInContainer("apache-ignite-fabric/bin/control.sh",  "--activate");

   ignite = Ignition.startClient(
        new ClientConfiguration().setAddresses(igniteServerContainer.getContainerIpAddress() + ":" + igniteServerContainer.getFirstMappedPort())
    );


//Cache population

ClientCache<String, TreeSet<Item>> cache = ignite.getOrCreateCache(CACHE_NAME);

key = generateKey();
value = generateValue();

cache.put(key, value);

I have followed the online examples and it should be populating the cache normally, but I just get ClientConnectionExceptions saying the cluster is unavailable and I am very unsure why it is giving me that after being able to connect to the ignite container and then creating the cache normally.

Rayan
  • 1
  • 1
  • Could you at least share the stacktrace of the exception? – Max Jun 25 '19 at 07:02
  • Sorry. It's pretty much the same as how I explained but I've added an image link. – Rayan Jun 25 '19 at 13:39
  • each Ignite node writes its own log (https://apacheignite.readme.io/docs/logging#section-default-logging), please share this file with us – Max Jun 25 '19 at 14:51
  • Thanks for suggesting that. I didn't know that would contain more information and I have more to work with now. For posterity, it's just failing because its unable to deserialize the object due to a ClassNotFoundException. I used this example to access the container logs. https://www.testcontainers.org/features/container_logs/ – Rayan Jun 25 '19 at 17:27
  • My assumption after some research is that peer class loading is not enabled so its not getting the byte code it needs to put the object in its cache. Now to figure out how to enable it in a test container... – Rayan Jun 25 '19 at 17:41
  • you should set property IgniteConfiguration.peerClassLoadingEnabled to true in your xml or java configuration https://apacheignite.readme.io/docs/zero-deployment#section-peer-class-loading – Max Jun 26 '19 at 13:54

0 Answers0